[Top][All Lists]

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

Re: library search test fails, please help

From: Allan Caffee
Subject: Re: library search test fails, please help
Date: Mon, 23 Feb 2009 09:11:50 -0500

On Sun, Feb 22, 2009 at 8:53 PM, Duane Ellis <address@hidden> wrote:
> Allan Caffee wrote:
>> AC_CHECK_LIB (AFAIK) is not intended to handle static libraries.
> I don't know much about AC_CHECK_LIB..
>> The reason for this is that compilers handle static libraries quite
>> differently than shared object libraries.
> This I disagree with. To a developer, these are '99.9% functionally
> identical', with a confusing twist.
>> Compilers treat static libraries as a single big object file to be
>> included along with all the others.
> NO. This is fundamentally wrong.

Actually I was _completely_ wrong: They _are_ conceptually identical
from the viewpoint of the developer.  (I think when I tested this I made
the classic beginner's blunder of putting the -l flag _before_ the
object file referencing it and one bad assumption led to another.  :\)
You're correct, the method of specifying them with -l is in fact the
convention for static libraries.  So really AC_CHECK_LIB is perfectly
adequate for checking static libraries, and its documentation makes no
mention of this because it should have been obvious that it does so.
Sorry for the misinformation, folks.

Given that I suspect that Peter is correct:

On Sun, Feb 22, 2009 at 11:26 PM, Peter Johansson <address@hidden> wrote:
> aaragon wrote:
>> address@hidden:~/Lib/lib$ nm -g | grep flip |
>> c++filt
>> 00003c20 T cpputils::flip(double)
> Isn't the problem that flip(double) is in namespace cpputils?

I don't know that AC_CHECK_LIB will be able to accommodate your needs
since it's designed to work with C and not C++.  Is there a routine in
the library in the global namespace?  If not you could roll a simple
test together using the macros described in the manual:

I don't know of an existing macro capable of checking for functions in a
particular namespace.  Of course if all you really want to do is check
that you can link against a library named cpputils (static or dynamic)
you could just use:

AC_CHECK_LIB ([cpputils], [main])

But by doing this you can't be as confident that you're linking against
the correct cpputils.  (I.E Your cpputils as opposed to somebody else
who happened to provide a library by the same name.)


reply via email to

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