Re: __attribute__((constructor)) in dylib does not run with DYLD_INSERT_LIBRARIES
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) 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; } 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Brian Dantes wrote: So if you build libhello with -bundle instead of -dynamiclib it works somehow. But this is a no go for me. This email sent to site_archiver@lists.apple.com
participants (1)
-
Andreas Tobler