This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: -dlopen self
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Erik Poupaert <erik dot poupaert at chello dot be>
- Cc: GCJ Java <java at gcc dot gnu dot org>
- Date: Tue, 18 Mar 2003 23:54:20 -0500 (EST)
- Subject: Re: -dlopen self
On Tue, 18 Mar 2003, Erik Poupaert wrote:
> -export-dynamic doesn't do the trick, and linking with -dlopen self is
> rejected by gcj. Does anybody know how I can link to activate
> lt_dlopen(NULL)?
Not sure why it isn't working for you. I tried the following example, it
definitely works on my Red Hat box:
[jsturm at suzy tmp]$ cat dltest.c
#include <stdio.h>
#include <dlfcn.h>
int x = 5;
int main(void) {
void *handle;
int *p;
handle = dlopen(NULL, RTLD_GLOBAL);
p = dlsym(handle, "x");
if (p)
printf("%x\n", *p);
else
fprintf(stderr, "%s\n", dlerror());
return 0;
}
[jsturm at suzy tmp]$ gcc -Wall dltest.c -o dltest -Wl,--export-dynamic -ldl
[jsturm at suzy tmp]$ ./dltest
5
[jsturm at suzy tmp]$ gcc --version
gcc (GCC) 3.3 20030309 (prerelease)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
[jsturm at suzy tmp]$ ld --version
GNU ld version 2.13.90 20030308
Copyright 2002 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.