Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com From: jeffdbREMOVETHIS AT goodnet DOT com (Mikey) To: T J Harding , cygwin AT sourceware DOT cygnus DOT com Subject: Re: How to handle variables (data, etc.) in DLLs? Date: Thu, 04 Mar 1999 22:49:19 GMT Organization: Never Reply-To: jeffdbREMOVETHIS AT goodnet DOT com Message-ID: <36df0dd7.190438502@mail.goodnet.com> References: <36DD41B4 DOT BF1C00D7 AT quadstone DOT com> <199903031619 DOT LAA28028 AT envy DOT delorie DOT com> <36DE5309 DOT 24E587FB AT quadstone DOT com> In-Reply-To: <36DE5309.24E587FB@quadstone.com> X-Mailer: Forte Agent 1.5/32.452 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 cygwin-unsubscribe AT sourceware DOT cygnus DOT com