Mail Archives: cygwin/1998/01/20/13:30:48
You almost have it. The problem is that the symbols baz and zip are
actually pointers to thunk functions in the DLL (and similarly the symbol
bar is a pointer to a thunk in the executable). The thunk functions simply
look up the appropriate pointer in the jump table for the DLL and call
that function. Obviously this won't work for variables. What you have to
do in that case is something like
extern int* __imp__zip;
#define zip (*__imp__zip)
in your DLL code (but not in the executable). This only works because we
know that dlltool names each of the entries in the jump table
__imp_<symbol> (and the actual symbol for zip is _zip, but anyway). This
may change in the future (especially since MS's standard is something like
_imp___zip IIRC), but for now it will work.
On the other hand I'm sure you know that global variables are evil. :)
Good luck,
Colin.
PS. I think MS does this basically the same way, except the compiler knows
how to handle it all internally based on the __dllexport (or some such)
keyword.
-- Colin Peters -- colin at fu.is.saga-u.ac.jp
-- Saga University Dept. of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin
-- http://www.geocities.com/Tokyo/Towers/6162
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -