Re: __attribute__((constructor)) in dylib does not run with DYLD_INSERT_LIBRARIES
Re: __attribute__((constructor)) in dylib does not run with DYLD_INSERT_LIBRARIES
- Subject: Re: __attribute__((constructor)) in dylib does not run with DYLD_INSERT_LIBRARIES
- From: Andreas Tobler <email@hidden>
- Date: Wed, 02 Mar 2005 07:05:57 +0100
Peter O'Gorman wrote:
| So if you build libhello with -bundle instead of -dynamiclib it works
| somehow. But this is a no go for me.
Why?
Well, the sample I showed was with dlopen, yes. But I need it in general
with dylibs. I tried to build libgcj with -bundle but this conflicts
with the whole gcc tree. So I really need -dynamiclib.
| I'm not aware of any workaround for panther.
Since you are dlopening the library, and panther uses dlcompat, and
dlcompat
looks for a symbol named "_init", you can use a hack. Inserting a "void
_init() { ; }" into the .c file which has your static constructors should
cause them to be called. They must appear in the same translation unit as
the static constructor, or you must link your library using the
- -single_module flag if you want dyld to call them.
If I were you I'd check for different dlopen and dyld behavior on tiger...
My need is more or less covered in tiger. I expect some issues but I
can't test that often.
There is no workaround for getting libraries inserted with
DYLD_INSERT_LIBRARIES to have their static constructors called on panther
that I know of. Nor is there any standard that I am aware of which requires
this functionality.
Well, I can wait, or I _have_ to wait :)
Andreas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden