Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Constructors on static variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Constructors on static variables



>I have a dylib with a static variable declared in it, and I never hit this variable's constructor when I called NSAddImage from my main application.

How do you know?

>Is there something I need to call to get these constructors called after getting the mach_header back from NSAddImage?

Your dylib should have a section called "__mod_init_func" in the __DATA segment. That should be where the compiler placed a function to call your global objects' ctors. I don't know if NSAddImage is supposed to call it automatically, or whether you're supposed to do something. (I'm a mach-O newbie).
--
//-------------------------------------------------
email@hidden virtual-fx, inc. (617) 244-9694
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Constructors on static variables (From: Randy Croucher <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.