static or dynamic librabry

static or dynamic librabry

Post by ruby » Wed, 20 Feb 2002 18:50:12



Hi there,

I'm using redhat 6.2. My question is:

How could I know if a library (for example libxml) is a dynamic library
or a static libray? Can I assume all the libraries whose names end with
.a are static, and all those with names ending with .so are dynamic?

Thanks,
Ruby

 
 
 

static or dynamic librabry

Post by Josef M?ller » Wed, 20 Feb 2002 19:06:23



> Hi there,

> I'm using redhat 6.2. My question is:

> How could I know if a library (for example libxml) is a dynamic library
> or a static libray? Can I assume all the libraries whose names end with
> .a are static, and all those with names ending with .so are dynamic?

Since, on Linux/Un*x names are just ... errr ... names, "file" will tell
you:
/usr/lib/libvga.a:                       current ar archive

/usr/lib/libx11drv.so:                    ELF 32-bit LSB shared object,
Intel 80386, version 1, not stripped

Note that, while a lot of entries in /lib and /usr/lib end with ".so",
most of them are symbolic links to the current version of that library,
e.g. (in /usr/lib):

libcrypto.so -> libcrypto.so.0
libcrypto.so.0 -> libcrypto.so.0.9.6
libcrypto.so.0.9.6: ELF 32-bit LSB shared object, Intel 80386, version
1, not stripped

--
Josef M?llers (Pinguinpfleger bei FSC)
        If failure had no penalty success would not be a prize
                                                -- T.  Pratchett

 
 
 

static or dynamic librabry

Post by Nils O. Sel?sd » Wed, 20 Feb 2002 21:56:19



>Hi there,

>I'm using redhat 6.2. My question is:

>How could I know if a library (for example libxml) is a dynamic library
>or a static libray? Can I assume all the libraries whose names end with
>.a are static, and all those with names ending with .so are dynamic?

Thats atleast the rule in naming libraries. If you want to be sure,
try the command file libalib.so
 
 
 

1. shmem works static-linked, but not dynamic-linked

Shared-memory works on static-linked by not dynamic-linked program:

I wanted to use shared-memory between 2 processes in my application.
I first tried a small test, with one Reader Process that creates and
attaches (shmget, shmat) a shared segment, and one Writer Proces that
attaches afterward. The Writer writes data into the segment, then
sets a ReadDataAvailable flag at a known location in the segment.
The Reader polls that flag, and reads the data when the flag is set.

All this works nicely when the Writer is a static-linked program.
When the Writer is packaged as a ".so" lib, then something breaks.
The Reader can still detect the ReadDataAvailable flag change state,
but when it tries to read the data, all the locations are zeros.

Note that this is EXACTLY the same program code (C) in each case;
I did check with nm and it seems that the shmget/shmat calls are
in each case invoking via GLIBC_2.0.

I suspect this is a glitch in the CPU primary or secondary cache?
The write-through is buggy? Yet it is surprising that the flag
location is written ok, and data that is only a few locations away
is lost... HELP!

I tried 2 different systems, both VALinux:
VALinux 1-CPU i386  v 2.0.36, gcc v 2.7.2.3, ld v2.9.1 (~=RedHat5.2?)
and
VALinux 2-CPU i386 v2.2.12-29.4 smp, (~=RedHat6.0?)
gcc egcs-2.91.66, ld v2.9.5

Sent via Deja.com http://www.deja.com/
Before you buy.

2. partition blues

3. dhcpd complaining about dynamic and static leases

4. emu10k1 Driver

5. dynamic linking -> static linking == some _smaller_ executables

6. x86 Solaris 7 Network Adapter Installation

7. Dynamic -> Static IP address problem - Solved!

8. Adaptec 1540CF - HELP!!!

9. f77 linker and static/dynamic libs

10. Changing executable linking from dynamic to static

11. Q: help on static/dynamic linking

12. Convert from static to dynamic IP and ppp config

13. dynamic vs static routing