Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <382DDDA3.D84AB37E@wanadoo.fr> Date: Sat, 13 Nov 1999 21:52:36 +0000 From: Vincent Penne Organization: OVR/SasHipA X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i586) MIME-Version: 1.0 To: cygwin AT sourceware DOT cygnus DOT com Subject: Re: Building C++ library DLL Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Thanks again for quick answer ! > > But with a more complicate library, I still have some internal compiler > > error when using class that are defined as > > class __declspec(dllimport) foo > > This is of course illegal. You cannot *define* an imported class. That's > where all those preprocessor macros come in -- you declare when importing, > define when exporting. Here I am a bit surprised. What I am doing,, and have seen done often, is something like this #ifdef LIBRARY #define API __declspec(dllexport) #else #define API __declspec(dllimport) #endif The library is compiled with the LIBRARY symbol set, and the header files contains things of that sort class API foo { ... }; API void some_function(); When the library is used, the same header files are used. Do you mean that doing this is not allowed ? I should rather do #ifdef LIBRARY #define API /* nothing */ #else #define API __declspec(dllimport) #endif #define DECL_API __declspec(dllexport) and then in sources of the library, DECL_API void some_function() { ... } This is of course a lot more annoying for the programmer when porting from a unix library where no such stupid things are necessary ... MSVC++ allow the first method ... -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com