How to handle variables (data, etc.) in DLLs?

Wed Mar 31 19:45:00 GMT 1999

#define extern __attribute__((dllimport))
extern int yourdata_in_dll;
#undef extern

not sure about egcs-1.1 but 1.1.1 this will work.

On Thu, 04 Mar 1999 09:31:53 +0000, you wrote:

>DJ Delorie wrote:
>> DLLs *can't* export "data".  They can only export pointers to data,
>> which is what they do.  In older gccs, you'll need to do something
>> like this:
>> extern int *__imp_foo;
>> #define foo (*__imp_foo)
>> In newer gccs, do something like this:
>> extern int foo __attribute__((dllimport));
>> These tell gcc to dereference the imported pointer, rather than
>> thinking it's the data itself.
>Thanks, that's useful to know (although there are about 250 of these
>data symbols in the code!).  I'd need to brush up on my C++ (yes, this
>is actually C++ code) to figure out what's required.

Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list