static and shared libraries


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users static and shared libraries
# 1  
Old 01-12-2008
static and shared libraries

can someone explain whether my understanding is correct

lets suppose we have a program that uses library x.

if x is static then the code of x will be part of our program, so if we're going to have 5 executables of our program, then each executable will have x as part of it.
Also, x does not have to be stored anywhere on the filesystem as it will be part of all execujtables.

if x is dynamic then the code of x will not be part of the program. Instead x will need to be placed somewhere on the system and the program x will look for x when it is run.

Thanks.
# 2  
Old 01-12-2008
You are correct, a static linked library will be included in the executable created, whereas a dynamic linked library will remain seperate and the library will need to be pressent on your system.
# 3  
Old 01-13-2008
Thanks for clarifying.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Self contained shared libraries

Does anyone know whether it is possible to make self contained shared libraries ? (.so files). If so, what is the way to do it ? ---------- Post updated at 08:03 AM ---------- Previous update was at 07:56 AM ---------- On Solaris that is. (6 Replies)
Discussion started by: lkb
6 Replies

2. Red Hat

shared libraries problem

hi, while running the below query it gives the shared libraries prmblem, $ cd /oracle/app/product/fmw/asinst_1/bin/ $ ./opmnctl status /oracle/app/product/fmw/Oracle_IDM1/opmn/bin/opmn: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: Permission... (0 Replies)
Discussion started by: rahulsword
0 Replies

3. Programming

Question about what Static Libraries are...

im used to windows dll which gets loaded at runtime, are static libraries the same? the ones i link with -l on gcc? i mean, if my app used libpng for example, and i compiled it to a single ELF executable and took it to another pc that have no libpng on it, will it work? or it will complain... (2 Replies)
Discussion started by: JonhyM
2 Replies

4. Programming

Static libraries and fork()

Hi, Let's say there's an application compiled with a static library. So, if the application forks processes, then the static library is copied, also? Or the static library codes are shared between the processes of the application? Thanks in advance. (2 Replies)
Discussion started by: xyzt
2 Replies

5. UNIX for Advanced & Expert Users

Shared Libraries- CRITICAL !!

Hi, I am trying to create a shared library from a .c file using gcc -c -fpic -I/usr/local/include Chksum.C -o Chksum.o gcc -shared -o libtclcksum.so Chksum.o when i try to load this shared library libtclcksum.so in tclsh % load libtclcksum.so I get the following error: couldn't load... (1 Reply)
Discussion started by: archana485
1 Replies

6. Linux

Shared Libraries

How do i make a library shared say i have a library a.so which i have just compiled. I want to make it shared how do i make it Next Queation is what is the difference between a.so.0 a.so.1 a.so.2 & a.so :rolleyes: (1 Reply)
Discussion started by: wojtyla
1 Replies

7. Programming

Static objects in libraries

Hi! I have the following problem with C++ programs on Unix: There is a binary executable program called, e.g. Main. It is dynamically linked with two shared libraries: Shared1 and Shared2. Both of these libraries, in turn, are statically linked with a static library called Static. This static... (0 Replies)
Discussion started by: maestro@altiris
0 Replies

8. UNIX for Dummies Questions & Answers

Clarification about shared Libraries

I have a doubt about the shared libraries. Where do you set the path for the shared libaries, for the dynamic loader to locate. Any suggestion would be of great help. thanks (3 Replies)
Discussion started by: ramkumar_gr
3 Replies

9. Programming

shared libraries

I am compiling code which produces .a and .la libraries. How can I produce .so libraries? I know that gcc -shared does but how? (2 Replies)
Discussion started by: thalex
2 Replies

10. Programming

Shared libraries

Hello everybody, I am having major problems at the moment with shared libraries and I have to little knowledge of them to solve them. So please, please help me :) Ok this is the problem: I have a library A, which uses B and C, and C uses again D. If I try to run A as plugin in apache,... (0 Replies)
Discussion started by: Micky
0 Replies
Login or Register to Ask a Question