kingbing -> dlopen + dlsym problem (Mar. 8, '06, 6:38:18 AM) |
Hi folks. I'm trying to build something using libglade, which sits on top of gtk. It's got a nice feature where it will automatically wire up events to event handlers (you specify an xml file that describes the interface, and the functions it calls when things happen).
This all works via dlopen/dlsym (via gmodule in glib), but this doesn't seem to work in Interix.
If you call dlopen(NULL,0) you should get a handle back to all the symbols in the current image. Calling dlsym from that should get you the address of a function in your own program. Unfortunately, it doesn't work - dlsym can only find items in shared libraries loaded by the current image.
Here's an example program:
#include <dlfcn.h>
int glib_underscore_test(void) { return 42; }
int main()
{
int i=glib_underscore_test();
void *f1=(void *)0, *f2=(void *)0, *handle;
handle=dlopen((void*)0,0);
if(handle)
{
f1=dlsym(handle,"dlsym");
if(!f1)
printf("%s\n",dlerror());
f1=dlsym(handle,"glib_underscore_test");
if(!f1)
printf("%s\n",dlerror());
f2=dlsym(handle,"_glib_underscore_test");
if(!f2)
printf("%s\n",dlerror());
}
else
printf(dlerror());
}
On my box, the call to find "dlsym" does not cause an error, but the calls to find "glib_underscore_test" and "_glib_underscore_test" do.
Anyone got any ideas?
Cheers
Matt |
|
|
|