delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/10/29/19:48:56

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
From: Steve Jorgensen <steve AT khoral DOT com>
Message-Id: <199910292348.RAA10804@benson>
Subject: Re: DLL creation problem
To: billtut AT microsoft DOT com (Bill Tutt)
Date: Fri, 29 Oct 1999 17:48:08 -0600 (MDT)
Cc: dj AT delorie DOT com, steve AT khoral DOT com, cygwin AT sourceware DOT cygnus DOT com
In-Reply-To: <4D0A23B3F74DD111ACCD00805F31D8100DB9148A@RED-MSG-50> from "Bill Tutt" at Oct 28, 99 07:56:02 pm
X-Mailer: ELM [version 2.4 PL25]

	This seems to be working.. Thanks to Bill and DJ for their help.

	So, did microsoft go into a room and brainstorm the hardest way
	to do shared libraries or is this an artifact of hacking gcc to
	do dll's? :)

					Steve
Bill Tutt wrote
>> > From: DJ Delorie [mailto:dj AT delorie DOT 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
>> 


-- 
-----------------------------------------------------------
Steven Jorgensen      steve AT khoral DOT com	    steve AT haunt DOT com
------------------------------+----------------------------
Khoral Research Inc.          | PHONE: (505) 837-6500
6200 Uptown Blvd, Suite 200   | FAX:   (505) 881-3842
Albuquerque, NM 87110         | URL: http://www.khoral.com/
-----------------------------------------------------------

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019