This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Accessing global variables when Linking against a cygwin built dll
- To: cygwin at sources dot redhat dot com
- Subject: Accessing global variables when Linking against a cygwin built dll
- From: "Max Feil" <mfeil at qnx dot com>
- Date: Mon, 19 Mar 2001 15:18:53 -0500 (EST)
Hello fellow cygwin-ites. I've recently started making more use of
shared libraries under cygwin, and I would appreciate the wisdom of
this discussion group on the topic of accessing global variables.
I am building a dll and exporting both functions and variables. When
I link my application with this dll, the symbols all get resolved
but the linker treats global variables the same as functions. It
binds the symbol of the global variable to a memory location containing
an indirect JMP via an entry in the dll export table. This works for
calling functions, but when accessing global data I have to do the
address lookup manually.
For example, if my global variable is called PtWindow, then in my
app I have to use the following #define:
#define PtWindow (*_imp__PtWindow)
What is the proper way to do this, so I don't have to do the #define myself?
Thanks,
Max
--
Max Feil | Email: mfeil@qnx.com
QNX Software Systems Ltd. | Web: http://staff.qnx.com/~mfeil
Kanata, Ontario, Canada. |
"Get the QNX Realtime Platform" |
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple