This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
RE: Accessing exported variables in DLL with dlsym().
- To: 'Andrej Borsenkow' <Andrej dot Borsenkow at mow dot siemens dot ru>, cygwin at sourceware dot cygnus dot com
- Subject: RE: Accessing exported variables in DLL with dlsym().
- From: Heribert Dahms <heribert_dahms at icon-gmbh dot de>
- Date: Thu, 6 Jul 2000 23:10:03 +0200
Hi Andrej,
if you can rebuild the DLL from source, you may do what TCL/TK
did years ago due to this Win* deficiency: Add simple wrapper
functions which just return the pointer to one of your variables.
Bye, Heribert (heribert_dahms@icon-gmbh.de)
> -----Original Message-----
> From: Andrej Borsenkow [SMTP:Andrej.Borsenkow@mow.siemens.ru]
> Sent: Thursday, July 06, 2000 10:59
> To: cygwin@sourceware.cygnus.com
> Subject: Accessing exported variables in DLL with dlsym().
>
> 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
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com