Bruno Haible <[email protected]> writes: > -#define LIBFOO_DLL_EXPORTED __attribute__((__visibility__("default"))) > -#elif (defined _WIN32 && !defined __CYGWIN__) && BUILDING_SHARED && > BUILDING_LIBFOO > -#define LIBFOO_DLL_EXPORTED __declspec(dllexport) > -#elif (defined _WIN32 && !defined __CYGWIN__) && BUILDING_SHARED > -#define LIBFOO_DLL_EXPORTED __declspec(dllimport) > +# define LIBFOO_DLL_EXPORTED __attribute__((__visibility__("default"))) > +#elif (defined _WIN32 && !defined __CYGWIN__) && @@BUILDING_SHARED@@ && > BUILDING_LIBFOO > +# if defined DLL_EXPORT > +# define LIBFOO_DLL_EXPORTED __declspec(dllexport) > +# else > +# define LIBFOO_DLL_EXPORTED > +# endif > +#elif (defined _WIN32 && !defined __CYGWIN__) && @@BUILDING_SHARED@@ > +# define LIBFOO_DLL_EXPORTED __declspec(dllimport)
Hi Bruno. The idea is that this code snippet would go into the public header file that is installed in /usr/include on people's system, so using @@BUILDING_SHARED@@ in it does not seem to work. I think some other technique or improved documentation is needed here. I must admit I'm not sure I understand the entire background here, and just looking at the end result. If there is no way in CPP to know if we're building code that will use libfoo as a shared library (symbols DLL_EXPORT or PIC?) I think it would be acceptable for the public header file to default to setting things up for using a shared library, but allow the user to specify a -DLIBFOO_STATIC_BUILD=1 or similar if she wants to build with a static libfoo. /Simon
signature.asc
Description: PGP signature
