Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@sourceware.cygnus.com>
List-Subscribe: <mailto:cygwin-subscribe@sourceware.cygnus.com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin@sourceware.cygnus.com>
List-Help: <mailto:cygwin-help@sourceware.cygnus.com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner@sourceware.cygnus.com
Delivered-To: mailing list cygwin@sourceware.cygnus.com
Message-ID: <4D0A23B3F74DD111ACCD00805F31D8100DB9148A@RED-MSG-50>
From: Bill Tutt <billtut@microsoft.com>
To: "'DJ Delorie'" <dj@delorie.com>, steve@khoral.com
Cc: cygwin@sourceware.cygnus.com
Subject: RE: DLL creation problem
Date: Thu, 28 Oct 1999 19:56:02 -0700
X-Mailer: Internet Mail Service (5.5.2650.21)



> From: DJ Delorie [mailto:dj@delorie.com]
> > 	So how do I make the above assignment (or any global variable
> > 	assignemnt) work as expected?
> 
> What we do is, in the header where you prototype the variable
> (i.e. the "extern int foo;" line), add a directive like this:
> 
> 	extern int foo __declspec(dllimport);
> 
> Note that you should *only* do this for the application; don't do it
> for the dll itself.
> 

Whats typically done is something like this:
#ifdef BUILD_XYZ
#define XYZAPI __declspec(dllexport)
#else
#define XYZAPI __declspec(dllimport)
#endif

and just write a header file like so:

XYZ.h might contain:

extern int foo XYZAPI;

Then when you're building the DLL, just define BUILD_XYZ.

Bill

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

