linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to write apps dependent on external libraries?
@ 2006-07-13 16:04 Shriramana Sharma
  2006-07-13 16:13 ` Mihai Dontu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Shriramana Sharma @ 2006-07-13 16:04 UTC (permalink / raw)
  To: Linux C Programming List

[-- Attachment #1: Type: text/plain, Size: 686 bytes --]

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.

-- 

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

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to write apps dependent on external libraries?
  2006-07-13 16:04 How to write apps dependent on external libraries? Shriramana Sharma
@ 2006-07-13 16:13 ` Mihai Dontu
  2006-07-13 16:40 ` Steve Graegert
  2006-07-14  0:28 ` Glynn Clements
  2 siblings, 0 replies; 5+ messages in thread
From: Mihai Dontu @ 2006-07-13 16:13 UTC (permalink / raw)
  To: linux-c-programming

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? 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.

> a .la? I am so very confused.
> 

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

> 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.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 



-- 
This message was scanned for spam and viruses by BitDefender.
For more information please visit http://www.bitdefender.com/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to write apps dependent on external libraries?
  2006-07-13 16:04 How to write apps dependent on external libraries? Shriramana Sharma
  2006-07-13 16:13 ` Mihai Dontu
@ 2006-07-13 16:40 ` Steve Graegert
  2006-07-14  0:28 ` Glynn Clements
  2 siblings, 0 replies; 5+ messages in thread
From: Steve Graegert @ 2006-07-13 16:40 UTC (permalink / raw)
  To: linux-c-programming

On 7/13/06, Shriramana Sharma <samjnaa@gmail.com> 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? 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to write apps dependent on external libraries?
  2006-07-13 16:04 How to write apps dependent on external libraries? Shriramana Sharma
  2006-07-13 16:13 ` Mihai Dontu
  2006-07-13 16:40 ` Steve Graegert
@ 2006-07-14  0:28 ` Glynn Clements
  2006-07-14 10:32   ` Markus Rechberger
  2 siblings, 1 reply; 5+ messages in thread
From: Glynn Clements @ 2006-07-14  0:28 UTC (permalink / raw)
  To: Shriramana Sharma; +Cc: Linux C Programming List


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@gclements.plus.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to write apps dependent on external libraries?
  2006-07-14  0:28 ` Glynn Clements
@ 2006-07-14 10:32   ` Markus Rechberger
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Rechberger @ 2006-07-14 10:32 UTC (permalink / raw)
  To: Glynn Clements; +Cc: Shriramana Sharma, Linux C Programming List

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

On 7/14/06, Glynn Clements <glynn@gclements.plus.com> wrote:
>
> 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@gclements.plus.com>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
Markus Rechberger

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-07-14 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-13 16:04 How to write apps dependent on external libraries? Shriramana Sharma
2006-07-13 16:13 ` Mihai Dontu
2006-07-13 16:40 ` Steve Graegert
2006-07-14  0:28 ` Glynn Clements
2006-07-14 10:32   ` Markus Rechberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).