• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problems in running a command line tool that links against AppKit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems in running a command line tool that links against AppKit


  • Subject: Problems in running a command line tool that links against AppKit
  • From: Piers Uso Walter <email@hidden>
  • Date: Fri, 27 Jun 2003 12:54:10 +0200

I'm trying to write an AppKit application that optionally also works as a command line tool (if called with the right parameters). When running as a command line tool, this application does not use any AppKit functionality.

The whole thing works quite well, except for the problem that a user must be logged in, or else the program won't start. Apparently, once a program is linked against AppKit, some initialization takes place that requires a Window Server connection (or something similar).

To research this, I've taken a Hello World Foundation Tool project and linked it against AppKit. No AppKit functionality is used at all. This is what happens when this tool is called:

(gdb) r
Starting program: /Network/Users/piers/CommandLineCallable
[Switching to thread 1 (process 5506 thread 0x200b)]
kCGErrorIllegalArgument : initCGDisplayState: cannot map display interlocks.
kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
kCGErrorInvalidConnection : CGSGetEventPort: Invalid connection

Breakpoint 3, 0x700051e8 in exit ()
(gdb) bt
#0 0x700051e8 in exit ()
#1 0x73186f8c in BindCGSToRunLoop ()
#2 0x7319715c in ToolboxEventPlatformInitialize ()
#3 0x731c7070 in INIT_ToolboxEvents ()
#4 0x7319b238 in _InitHLTB ()
#5 0x41108ac0 in __dyld_call_image_init_routines ()
#6 0x41112b0c in __dyld__dyld_make_delayed_module_initializer_calls ()
#7 0x00003ab8 in _call_mod_init_funcs () at /SourceCache/Csu/Csu-45/crt.c:299
#8 0x000039a0 in _start (argc=1, argv=0xbffffba8, envp=0xbffffbb0) at /SourceCache/Csu/Csu-45/crt.c:217
#9 0x00003900 in start ()


Does anybody know a way around this?
Can I somehow postpone the AppKit initialization that causes the errors until I know that I'll be launching the GUI, let's say to right before I call NSApplicationMain()?
Or do I have to stop linking against AppKit and somehow dynamically load AppKit later on? If so, how would I be able to do this (the Apple documentation seems to insinuate that only bundles can be dynamically loaded)?


With kind regards

Piers Uso Walter <email@hidden>
ilink Kommunikationssysteme GmbH
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Problems in running a command line tool that links against AppKit
      • From: H}kan Johansson <email@hidden>
  • Prev by Date: getting started with WebKit
  • Next by Date: Re: getting started with WebKit
  • Previous by thread: Re: getting started with WebKit
  • Next by thread: Re: Problems in running a command line tool that links against AppKit
  • Index(es):
    • Date
    • Thread