Sorry if this is a FAQ. I'm building a library using the pr-msvc-support branch of libtool so I'm using native MSVC tools. When building a shared lib I'm doing one of the methods prescribed here:
http://www.gnu.org/software/gnulib/manual/html_node/Exported-Symbols-of-Shar ed-Libraries.html Specifically: #if BUILDING_LIBFOO && HAVE_VISIBILITY #define LIBFOO_DLL_EXPORTED __attribute__((__visibility__("default"))) #elif BUILDING_LIBFOO && defined _MSC_VER #define LIBFOO_DLL_EXPORTED __declspec(dllexport) #elif defined _MSC_VER #define LIBFOO_DLL_EXPORTED __declspec(dllimport) #else #define LIBFOO_DLL_EXPORTED #endif Trouble is, this doesn't handle the case where I'm building a static lib using MS tools. In that case I (think I) want the macro to be empty. I'm fine to jimmy around the preprocessor logic to use an addition symbol like LIBFOO_STATIC to have it end up that way, but I don't see a way to define LIBFOO_STATIC only when compiling the static lib. In the case where a build directory is configured for static only (e.g. invoked with --disable-shared) I can add -DLIBFOO_STATIC to one of the CPPFLAGS variables, but if a build directory is configured for both, I don't see how to define LIBFOO_STATIC only in the static case. Am I going about this the right way? Thanks for your help. -DB $ libtool --version libtool (GNU libtool 1.3107 2009-03-20) 2.2.7a Written by Gordon Matzigkeit <g...@gnu.ai.mit.edu>, 1996 Copyright (C) 2009 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. _______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool