> Message: 2 > Date: Sun, 06 Sep 2009 17:34:39 +0200 > From: Jason Curl <jcurln...@arcor.de> > Subject: Re: Detecting Static/Shared builds > To: Monty Taylor <mord...@inaugust.com>, Bob Friesenhahn > <bfrie...@simple.dallas.tx.us> > Cc: libtool@gnu.org > Message-ID: <4aa3d68f.4010...@arcor.de> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Monty Taylor wrote: >> In my builds, libtool is doing: >> >> -fPIC -DPIC >> >> Which would mean you should be able to do: >> >> #ifdef PIC >> >> or the like. From reading the libtool.m4 file, it looks like it will not >> add -DPIC if you are using djgpp. >> >> Monty >> > This doesn't sound very friendly at all! libtool exports DLL_EXPORT from > what I can tell, only when I'm building Win32 DLL. I can't see if > anything is defined when either importing, or building the library when > static. > > So great, I can figure out when I need to use __declspec(dllexport). But > I don't know when I should use __declspec(import) or nothing (e.g. > importing from a DLL or using a static lib respectively). > > Any other ideas?
The main problem is, that the _executable_ can never know for shure, wether -DPIC was given on the command line while building the _library_. You may be interested in parity [1], which manages all this. With parity (which is a wrapper around visual c++), you can _akways_ do __declspec(dllimport) (and never dllexport), and things will work in all static/shared combinations. Parity also plays nice with libtool, if you apply a patch. If you have questions, you're welcome. [1] http://sourceforge.net/projects/parity/ Cheers, Markus > > I thought about a macro in Makefile.am to know when I'm building, but > the program importing the library then needs to know. Sounds like > something that would then be best in the ".la" file that libtool knows > about. > [snip] _______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool