[Top][All Lists]

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

Detecting Static/Shared builds

From: Jason Curl
Subject: Detecting Static/Shared builds
Date: Fri, 04 Sep 2009 22:06:15 +0200
User-agent: Thunderbird (Windows/20090812)


I've set up a library that can be built on Windows (mingw32 or cygwin) or on a Unix type OS (e.g. Linux or Solaris). I've defined a header that checks if the WINDOWS_H file exists and if it does, I then define things like LIBAPI, WINAPI, DLLEXPORT.

That all works when I build a shared library.

But when I build a static library that will link with the executables (primarily to make debugging easier), on Windows platforms I have problems because LIBAPI is still defined decl(dllexport) and it doesn't need to be.

Is there anyway from the libtool system to know if the current file being compiled is for static or shared, maybe through a #define? I've skimmed through the libtool manual but not found anything terribly relevant except for section 5.6 (Static-only libraries).

But I believe this problem can occur even if I build both, then I need to figure out which invocation (shared or static) and so a variable in won't work either, probably something passed on the command line.

Of course, it's only a problem on Windows (my main platform).

It might be I use a compiler other than GNU (e.g. Intel, or MSVC) so I'd like to avoid compiler specific features, but I'll always be using autoconf and friends.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]