Re: How to write apps dependent on external libraries?

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

 



Shriramana Sharma wrote:

> Often I see apps which are dependent on this .so file or that. I don't know 
> how apps can be written that depend on libraries that are not linked into the 
> executable. So far I have been linking all needed libraries into the 
> executable.
> 
> A .so is a collection of what?

A .so (shared object) is structurally quite similar to a single .o
file. The difference is that a .so is meant to be able to be linked at
run-time.

Linking against a .so file doesn't copy the code/data from the .o file
to the executable; it just stores references to the .so file in the
executable.

The loader (ld-linux.so) will load any shared libraries which the
executable requires when the executable is loaded. If it can't find
one or more libraries, you get an error when you try to run the
executable.

> An .a is a collection of .o-s, right?

It can be a collection of anything (a .a file is just an archive,
similar to a .zip file), but it's usually just a collection of .o
files.

Linking against a .a file is similar to linking against the individual
.o files which it contains, except that only those .o files which
supply a required symbol (function, variable) are used.

> What is a .la?

A .la file is a metadata file created and used by libtool. It contains
information (e.g. dependencies) which libtool needs to link against a
static library.

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
-
: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux