Ordering of function pointers in mod_init_funcs
Ordering of function pointers in mod_init_funcs
- Subject: Ordering of function pointers in mod_init_funcs
- From: James Milne <email@hidden>
- Date: Wed, 04 Jan 2006 01:57:48 +0000
I have a symbol which I have specified should be part of the mod_init_funcs section like so:
void PreMain_Init_MacOSX( void ) __attribute__ ((section("__DATA,__mod_init_funcs")));
void PreMain_Init_MacOSX( void )
{
//blah
}
(I know about the __attribute__((constructor)), and it pretty much does the same thing.)
According to the documentation, all C++ static global constructors are also part of the mod_init_funcs section. This seems correct, as the function _call_mod_init_funcs in the CRT bootstrap code is calling into these constructor functions.
Is there any way to influence the order in which these function pointers are called? The symbols seem to have __Z prepended to them when they are added to the section, which implies they're being forced to the end of the __mod_init_funcs section (assuming symbols living in the section are ordered alphabetically.)
Ideally, I'd like my PreMain_Init_MacOSX() function to be called before any global static constructors are executed.
Any advice? Can I add any clever prefix to my function names, or use an attribute, to get them to appear at the start of the mod_init_funcs section?
--
James Milne
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden