Re: Initialization Routine
Re: Initialization Routine
- Subject: Re: Initialization Routine
- From: Andrew Kimpton <email@hidden>
- Date: Wed, 25 Feb 2004 09:42:28 -0800
On Feb 25, 2004, at 9:21 AM, Randy Croucher wrote:
> Hello,
>
> I am building a dynamic library and want to have a function called
> when the library is first loaded. If I set the "Initialization
> Routine" to something, like FooInit, I get a link error (undefined
> FooInit) even though I have defined the function (void FooInit()).
>
> What is the prototype for this function? Or is there a different way
> to do this?
>
#pragma CALL_ON_LOAD InitMachOLibrary
extern "C" void InitMachOLibrary();
void InitMachOLibrary()
{
}
and
#pragma CALL_ON_UNLOAD TerminateMachOLibrary
extern "C" void TerminateMachOLibrary();
void TerminateMachOLibrary()
{
}
Is what I use - I believe Mach-O supports multiple call_on_load/unload
functions, though I haven't had a need to try it. Note this doesn't
need an explicit Xcode settings, it just uses the pragma features of
gcc
> Randy
>
Andrew 8-)
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.