Accessing exported variables in DLL with dlsym().

Andrej Borsenkow Andrej.Borsenkow@mow.siemens.ru
Thu Jul 6 01:59:00 GMT 2000


I am trying to port a program that opens dynamic library with dlopen()
and looks up symbol with dlsym(). This works for function reference but
not for variable. The porgram is:
main.c:
#include <dlfcn.h>
#include <stdio.h>
main() {
 int (*foo)(void);
 void *libfoo;
 libfoo = dlopen ("libfoo.dll", 0);
 foo = dlsym (libfoo, "foo");
 foo();
}
foo.c:
#include <stdio.h>
#include <dlfcn.h>
__declspec (dllexport) extern foo (void);
foo() {
 char *bar;
 void *libbar;
 libbar = dlopen ("libbar.dll", 0);
 bar = dlsym (libbar, "bar");
 puts (bar);
}
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /