Unix Programming - what is the difference between static and dynamic libs

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2005 > what is the difference between static and dynamic libs





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author what is the difference between static and dynamic libs
puzzlecracker

2005-12-22, 2:58 am

Under windows, it is quite apparent: static is added to executable
entirely during linking and latter is added only open referenced and
searched using PATH. Thus, dynamic libs are not really added but lib
file has a pointer to a dynamic lib.

is the concept the same under gnu linux? what do you set and how does
it work? examples and/or references would be appreciated.

Thanks

Thobias Vakayil

2005-12-22, 2:58 am

puzzlecracker wrote:

>Under windows, it is quite apparent: static is added to executable
>entirely during linking and latter is added only open referenced and
>searched using PATH. Thus, dynamic libs are not really added but lib
>file has a pointer to a dynamic lib.
>
>is the concept the same under gnu linux? what do you set and how does
>it work? examples and/or references would be appreciated.
>
>Thanks
>
>
>

While running the application, you have to set the LD_LIBRARY_PATH variable,
which has path of all run time libraires.

Regards,
Thobias Vakayil
Alcatel Development India (ADI)
PH: 2349961/72/86 EXTN :7018
Roger Leigh

2005-12-22, 7:50 am

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"puzzlecracker" <ironsel2000@gmail.com> writes:

> Under windows, it is quite apparent: static is added to executable
> entirely during linking and latter is added only open referenced and
> searched using PATH. Thus, dynamic libs are not really added but lib
> file has a pointer to a dynamic lib.
>
> is the concept the same under gnu linux? what do you set and how does
> it work? examples and/or references would be appreciated.


info ld
http://people.redhat.com/drepper/dsohowto.pdf


- --
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>

iD8DBQFDqnEzVcFcaSW/uEgRAg+WAJ9ckjmSmMQCZv1SDawGk/fnfvb+iQCgrRP1
ID+rGjo3DS5KswWpJbX6q8s=
=6N4D
-----END PGP SIGNATURE-----
Thomas Maier-Komor

2005-12-22, 7:50 am

Thobias Vakayil wrote:
> puzzlecracker wrote:
>

generally speaking it is the same concept. But there are differences.
[vbcol=seagreen]
> While running the application, you have to set the LD_LIBRARY_PATH
> variable,
> which has path of all run time libraires.
>


If you have to set LD_LIBRARY_PATH the application is broken. The
ELF binary should contain a RUNPATH that points to directories
containing the required libs. It can be set passing the option
-R to the LINKER. You can set the runpath relative to the
executable using the $ORIGIN value. In this case the user
is not bound to place to binary in a specific directory, but
is free to choose any location he likes.

Tom
Ralf Fassel

2005-12-22, 7:50 am

* "puzzlecracker" <ironsel2000@gmail.com>
| is the concept the same under gnu linux? what do you set and how
| does it work? examples and/or references would be appreciated.

http://www.tldp.org/HOWTO/Program-L...OWTO/index.html

HTH
R'
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com