Bug 275 - Cannot use RTLD_GLOBAL in dlopen
Summary: Cannot use RTLD_GLOBAL in dlopen
Status: RESOLVED INVALID
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.3.2
: P2 critical
Target Milestone: ---
Assignee: GOTO Masanori
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-21 03:11 UTC by Feng QIN
Modified: 2004-07-21 08:18 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Feng QIN 2004-07-21 03:11:05 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?
Comment 1 Andreas Schwab 2004-07-21 08:18:01 UTC
RTLD_GLOBAL by itself is an invalid argument for dlopen, you must have at least 
RTLD_NOW or RTLD_LAZY.