This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Accessing global variables when Linking against a cygwin built dll


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]