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: Tue, 01 Mar 2005 17:55:39 +0100
Brian Dantes wrote:
Andreas,
Thanks mucho for the confirmation, but aaargh.
Any workaround in Panther you're aware of?
Do you have a Radar number? I'd like to reference yours in the bug report I
made, if so.
3824565
My sample I pasted there looks like this:
------
libhello.cc
#include <stdio.h>
int i = printf("hello, I'm a static constructor\n");
void foo_print(void) {
}
------
demo_hello.cc
// Compiled with: g++ \
// -g -o demo_hello demo_hello.cc -L. -ldl
#include <dlfcn.h>
#include <stdlib.h>
#include <stdio.h>
int main(void) {
const char *error;
void *module;
module = dlopen("libhello.so", RTLD_LAZY);
if (!module) {
fprintf(stderr, "Couldn't open libhello.so: %s\n",
dlerror());
exit(1);
}
/* All done, close things cleanly */
dlclose(module);
return 0;
}
So if you build libhello with -bundle instead of -dynamiclib it works
somehow. But this is a no go for me.
I'm not aware of any workaround for panther.
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