Subject: Re: How to handle variables (data, etc.) in DLLs?
From: [email-masked] (Mikey)
To: T J Harding <[email-masked]>, [email-masked]
Date: Thu, 04 Mar 1999 22:49:19 GMT

yourfile.h
#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.
>
>Tim

--
Want to unsubscribe from this list?
Send a message to [email-masked]