Sources Bugzilla – Bug 275
Cannot use RTLD_GLOBAL in dlopen
Last modified: 2004-07-21 08:18:01 UTC
I'll try the following simple code from help dlopen, but failed and got following information: : invalid mode for dlopen(): Invalid argument And the code: #include <string> #include <stdio.h> #include <dlfcn.h> int main(int argc, char **argv) { void *handle; double (*cosine)(double); char *error; handle = dlopen (argv[1], RTLD_GLOBAL); if (!handle) { fprintf (stderr, "%s\n", dlerror()); exit(1); } printf("Got 0x%x from %s.\n", handle, argv[1]); dlclose(handle); return 0; } Could you help me to check it?
RTLD_GLOBAL by itself is an invalid argument for dlopen, you must have at least RTLD_NOW or RTLD_LAZY.