[Top][All Lists]

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

Re: Libtool, SWIG and testing

From: Gavin Smith
Subject: Re: Libtool, SWIG and testing
Date: Tue, 28 Jul 2015 18:55:10 +0100

On 28 July 2015 at 16:58, Guillaume Marcais <address@hidden> wrote:
> On Sat, Jul 25, 2015 at 9:41 AM, Gavin Smith <address@hidden>
> wrote:
>> I'd suggest not hard-coding the name of the shared library in the Perl
>> code. It could be extracted from the *.la file. That would likely
>> improve portability. I don't see any way to avoid looking in .libs.
> Thank you for your answer.
> In this case, the Perl code that loads the shared library is generated by
> SWIG ( It does use DynaLoader and calls "bootstrap mummer;". The
> part that builds this library reads:
> perlextdir = $(PERL_EXT_LIB)
> perlext_SCRIPTS = perl5/
> perlext_LTLIBRARIES = perl5/
> perl5_mummer_la_SOURCES = perl5/swig_wrap.cpp $(SWIG_SRC)
> plus some other flags set in _CPPFLAGS, _LDFLAGS etc. Could really LIBTOOL
> build a shared object in the .libs directory that could not be loaded by
> "bootstrap mummer;"?

>From DynaLoader manpage:


               @filepaths = dl_findfile(@names)

           Determine the full paths (including file suffix) of one or more
           loadable files given their generic names and optionally one or more
           directories.  Searches directories in @dl_library_path by default
           and returns an empty list if no files were found.

           Names can be specified in a variety of platform independent forms.
           Any names in the form -lname are converted into libname.*, where .*
           is an appropriate suffix for the platform.


           bootstrap($module [...])

           This is the normal entry point for automatic dynamic loading in

           It performs the following actions:

           ·       locates an auto/$module directory by searching @INC

           ·       uses dl_findfile() to determine the filename to load

so this relies on libtool creating the file and calling it
"" or similar. That's reasonably likely; I was being safe
because I figured that libtool added the "dlname" line to the *.la
file for a reason, for example:

# The name that we can dlopen(3).

> In other words, for testing, I would rather use the Perl code that is
> generated by SWIG and that will ultimately will be installed, rather than
> having to write my own loader. So far it seems to work by only tweaking the
> environment with only the name ".libs" being really hard coded here. The
> name of the library is coming from the (perl5/

There are two library files, the *.la file and the actual file that is
dlopen'd, which could be a *.so file.

Does SWIG know anything about libtool?

Maybe you could ask on the libtool mailing list whether you can rely
on the library file being placed in .libs.

reply via email to

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