libtool
[Top][All Lists]
Advanced

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

Re: windows static archive, missing symbols


From: Brian Dessent
Subject: Re: windows static archive, missing symbols
Date: Fri, 19 Jan 2007 18:36:42 -0800

Bob Rossi wrote:

> I know the symbols are in the library because nm tells me so,
>   $ nm -g /home/bobbybrasko/download/pcre/pcre/install/lib/libpcre.a|grep 
> compile
>   libpcre_la-pcre_compile.o:
>   00005550 T _pcre_compile

Note here that this is just a regular symbol, as you would expect with a
non-shared library.

>   -I/home/bobbybrasko/download/pcre/pcre/install/include
>   C:/WINDOWS/TEMP/ccgGAsIC.o(.text+0x2e): In function `main':
>   C:/msys/1.0/home/bobbybrasko/download/pcre/pcre/build/tmp/test.c:13:
>     undefined reference to `_imp__pcre_compile'                               
>  
But here you're trying to dllimport the symbol.  But you don't want to
do that in the case of static linking.  You'll have to look at the
header and see how the dllimport/dllexport is #defined, usually it means
you have to add some extra -DSTATIC or similar when you are using the
static archive so that the prototypes are not defined dllimport.  If
libpcre is a libtoolized library and you used libtool to compile instead
of invoking gcc yourself it should take care of this for you, though. 
That's kind of the whole point of libtool, to abstract this away.

> Does anyone understand why I'd be getting these errors? Are .def files
> important for static windows libraries or only for dll's? Any advice?

AFAIK .def files have absolutely nothing to do with static libraries,
which are just collections of .o files really.  A .def file is used to
express what symbols a given .dll exports and imports, but these
concepts don't even exist in the case of a static library.

Brian




reply via email to

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