CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    ".la" file in Linux programming

    When I build a Linux shared object I usually end up with at least 3 new components:- the ".so" file itself, its import library (".a") file and a third file with the extension ".la".

    Strictly speaking, I'm building under Cygwin (not literally Linux) but AFAICT, the ".la" file serves no purpose whatsoever. It seems to be a text file containing the name of the shared object together with the name of its associated import lib and a few bits of other information (such as where each file needs to be located). But if I try changing the name of (say) the import lib and then I reflect this in the ".la" file, I can't subsequently link to the import lib. If I were to rename mylib.a and call it mylib.b a subsequent project wouldn't be able to link to mylib - even if I reflected my change in the ".la" file..

    I'm not doing this for any reason - I'm just trying to understand what function is served by the ".la" file. Is it just there for information purposes? Or is it only used by certain tools (e.g. make)? Or is it there for historical reasons? What is its relevance?
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  2. #2
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,158

    Re: ".la" file in Linux programming

    I don't know about 'la' files, but in Linux/Unix the rule is: each library name has to begin with 'lib' and it ends on either '.so' or '.a'.
    The linker is told to link library libmylib.so or libmylib.a by '-lmylib' and will choose it depending on the library path set with -L if it can find any.

    Does that help?
    Richard

  3. #3
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: ".la" file in Linux programming

    There is a very obscure and complicatted technology called Google. In case that is too difficult.....

    GNU libtool is a generic library support script. Libtool hides the complexity of using shared libraries behind a consistent, portable interface. These files contain necessary information for libtool to ease linking proces during compilation; they contain library names, location and dependent libraries used during linking. .....
    Note the seemingly odd “.lo”, “.la” files as well as both static libraries and dlls (shared libraries) for libfoo. A good explanation of libtool, the GNU program that manages shared libraries, can be found here: http://developer.gnome.org/doc/books...libraries.html. In general, when using libtool libraries (denoted by the AC_PROG_LIBTOOL macro in the configure.in script), a file extension of “.la” is used instead of “.so”, “.dylib”, “.dll”, or “.a”. Libtool creates an abstraction for all the library nuances.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  4. #4
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,158

    Re: ".la" file in Linux programming

    thanks ;-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured