I tried +load, and just before NSApplicationMain() (obviously that's within 
main, not before it), but got the same result.

My +load method was in my NSApplication subclass - maybe that's not the right 
place to put it? I'll peruse the documentation cited when I get a moment, but 
for now the relaunch is acceptable.

--Graham




On 10/01/2010, at 5:53 PM, Stephen J. Butler wrote:

> On Sun, Jan 10, 2010 at 12:36 AM, Ron Fleckner
> <ronfleck...@ozemail.com.au> wrote:
>> OK, thanks Dave and Stephen.  I think I'll have to find some documentation
>> which lists the order of function calls at app startup, though, because the
>> documentation for +load doesn't specifically say anything about app startup,
>> just class initialization, which I'm assuming is a different process.  In
>> fact, my uninformed guess is that class initialization would come more or
>> less last in the process of starting an application.  But, that's now my job
>> to find out if I can.
> 
> GCC documentation helps here. For functions with the constructor attribute:
> 
> <http://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/Function-Attributes.html#Function-Attributes>
> 
> ""The constructor attribute causes the function to be called
> automatically before execution enters main (). Similarly, the
> destructor attribute causes the function to be called automatically
> after main () has completed or exit () has been called. Functions with
> these attributes are useful for initializing data that will be used
> implicitly during the execution of the program.
> 
> These attributes are not currently implemented for Objective-C. ""
> 
> For Objective-C:
> 
> <http://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/Executing-code-before-main.html#Executing-code-before-main>
> 
> ""The GNU Objective-C runtime provides a way that allows you to
> execute code before the execution of the program enters the main
> function. The code is executed on a per-class and a per-category
> basis, through a special class method +load.""

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to