Skip to contentSkip to conversation

How to write apps dependent on external libraries?

DISCUSSION Shriramana Sharma 5 participants 5 messages Jul 13, 2006 – Jul 14, 2006

lore
Share & tools
lore
#0 lore raw

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? An .a is a collection of .o-s, right? What is a .la? I am so very confused.

I don't know what keywords to search for on Google. Which is why I ask here. If it is a detailed subject please give me keywords so I can search and find on my own.

Thanks for your help.

Signature · 3 lines
Tux #395953 resides at http://samvit.org
playing with KDE 3.53 on SUSE Linux 10.1
$ date [] CCE +2006-07-13 W28-4 UTC+0530
#1 lore raw
Quoted 3 lines · Shriramana Sharma

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? An .a is a collection of .o-s, right? What is

A .so (Shared Object) is a "collection of code". Basically the code from all .o-s is gathered _and_ _linked_ into this file.

Quoted 2 lines

a .la? I am so very confused.

.la is a libtool thinggy which contains different informations about how to create/load/link a .so

Quoted 9 lines

I don't know what keywords to search for on Google. Which is why I ask here. If it is a detailed subject please give me keywords so I can search and find on my own.

Thanks for your help.

------------------------------------------------------------------------

Signature · 2 lines
This message was scanned for spam and viruses by BitDefender.
For more information please visit http://www.bitdefender.com/
#2 lore raw
In reply to Shriramana Sharma
Quoted 7 lines · Shriramana Sharma

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? An .a is a collection of .o-s, right? What is a .la? I am so very confused.

An .so file is a shared library, a collection of object files, allowing executables to be linked against at __runtime__. They are called shared objects, because multiple processes can make use of them without keeping a private copy in their process space. Additionally, shared libraries are normaly self contained, which means that they do not contain references that cannot be resolved at runtime. For example, libpng makes use of routines from libz which is loaded at runtime automatically. If both libs were static (.a files, yes, a collection .o files) all programs that depend on those libraries must be linked against them at __compile time__. Shared objects are loaded into memory at runtime on behalf of another shared object ld.so and ld-linux.so for ELF binaries.

The .la files are used for linking and versioning by libtool and are created automatically. It is a simple text file that contains some important information for both static and shared libraries.

Hope that helped.

\Steve

#3 lore raw
In reply to Shriramana Sharma
Quoted 6 lines · Shriramana Sharma

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.

Quoted 1 line

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.

Quoted 1 line

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.

Signature · 1 line
Glynn Clements <[email protected]>
#4 lore raw

Hey,

Ulrich Drepper has written quite alot about shared libraries. He also did some performance tests uppon that topic.

* http://people.redhat.com/drepper/ (look at papers)
* http://udrepper.livejournal.com/

think it's better to read his papers first, bet noone will explain it that accuratly here.

Markus

Quoted 46 lines · Glynn Clements
Quoted 6 lines · Shriramana Sharma

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.

Quoted 1 line

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.

Quoted 1 line

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 <[email protected]>
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Markus Rechberger