[sigc] Compiling libsic++ as a DLL under Windows



I am trying to build a Win32 DLL from libsigc++ (see http://lists.gnome.org/archives/libsigc-list/2004-July/msg00027.html for another message on the subject).

 

Among other things, I need to export some symbols from the DLL using the __declspec(dllexport) Microsoft stuff. I have therefore defined a SIC_API macro as suggested by James Lin.

 

The macro is used on several places:

connection.h :

   l 39 : struct SIGC_API connection

 

trackable.h :

   l 35 : struct SIGC_API trackable_callback

   l 49 : struct SIGC_API signal_base : public trackable

   l 89 : struct SIGC_API trackable

 

signal_base.h :

   l 43 : struct SIGC_API signal_impl

   l 139 : struct SIGC_API signal_exec

   l 195 : struct SIGC_API signal_base : public trackable

 

adaptors\lambda\select.h :

   l 335 : SIGC_API extern const lambda<internal::lambda_select1> _1;

             SIGC_API extern const lambda<internal::lambda_select2> _2;

             SIGC_API extern const lambda<internal::lambda_select3> _3;

             SIGC_API extern const lambda<internal::lambda_select4> _4;

             SIGC_API extern const lambda<internal::lambda_select5> _5;

             SIGC_API extern const lambda<internal::lambda_select6> _6;

             SIGC_API extern const lambda<internal::lambda_select7> _7;

 

Functors\slot_base.h :

   l 52 : struct SIGC_API slot_rep : public trackable

   l 123 : struct SIGC_API slot_do_bind

   l 141 : struct SIGC_API slot_do_unbind

   l 206 : class SIGC_API slot_base : public functor_base

 

These are all the symbols I have identified that need to be exported from the DLL (basically, that is everything that is non template).

 

Now, the definition of the SIGC_API macro should be (according to MS standard way of doing things):

 

#ifndef SIGC_API

#ifdef _MSC_VER    //Visual C++ only

#ifdef SIGC_DLL_EXPORT

#define SIGC_API __declspec(dllexport)  

#else

#define SIGC_API __declspec(dllimport)

#endif

#else

#define SIGC_API

#endif

#endif

 

And SIGC_DLL_EXPORT should be defined in the Visual C++ project file used to build the DLL.

 

My question is: *WHERE* do I put the SIGC_MACRO definition? sigc++_config.h sounds like a good candidate, but it isn’t #included by all the headers where this macro is used. In fact there doesn’t seems to be a common header included by everyone where I could put it.  In LibSigC++ 1.2, it was done in sigcconfig.h, but there does not seems to be an equivalent in version 2.

 

Thanks for any idea.

 

PS: Once this problem solved, I could post an updated version of the Visual C++ project, if it may help.

 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]