tags:

views:

1384

answers:

1

Can somebody tell me what .la file is for? Also how it is used with shared object?

+2  A: 

It is textual file that includes description of library.

It allows libtool create platform independent names.

For example, libfoo goes to:

Under linux:

/lib/libfoo.so       # symlink to shared object
/lib/libfoo.so.1     # symlink to shared object
/lib/libfoo.so.1.0.1 # shared object
/lib/libfoo.a        # static library
/lib/libfoo.la       # libtool library

Under cygwin:

/lib/libfoo.dll.a    # import library
/lib/libfoo.a        # static library
/lib/libfoo.la       # libtool library
/bin/cygfoo_1.dll    # dll

Under windows mingw:

/lib/libfoo.dll.a    # import library
/lib/libfoo.a        # static library
/lib/libfoo.la       # libtool library
/bin/foo_1.dll       # dll

So.. libfoo.la is the only file that preserved between platforms by libtool allowing to understand, what happens with:

  • library dependencies
  • actual file names
  • library version and revision

Without depending on specific platform implementation of libraries

Artyom
so how to you turn the .la file to a platform specific shared lib file, like libfoo.la -> libfoo.so.*
theactiveactor
You can't libfoo.la holds only meta information, i.e. in libfoo.la (textual file) written where should you find libfoo.so.x.y.z
Artyom
@Artyom Does it mean that in order to generate .la file, I need to use libtool (e.g. from automake)? One can rely on `libtool` to link the object files (http://www.gnu.org/software/libtool/manual/html_node/Using-Automake.html) but if I want to distribute a library without .la, does it mean it will be very difficult to link with it using Cygwin or mingw?
dma_k