473,467 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to get the information of the dynamic linkink library in UNIX?

Hi all,

1> If there are more than one dynamic linking libraries in the file
system, how do I know which one is loaded into system? Any C library
or system call can tell me which *.so or *.sl is active? Can the
setting of LD_LIBRARY_PATH guanrantee that the correct one is
executed?

2> In MS-WINDOWS, once a DLL is loaded by one allication, this DLL
will be used by the subsequent appication. Does UNIX have the same
mechanism?

3> Or in UNIX the application always load the dynamic linking library
according to the paths specified by LD_LIBRARY_PATH.

4> Can the applications belonged to different user share the same
dynamic linking library? If not, how could it be called shared
library???
Thanks for your help.
Regards,

K.S.Liang
Nov 13 '05 #1
3 4240
K.S.Liang wrote:
Hi all,

1> If there are more than one dynamic linking libraries in the file
system, how do I know which one is loaded into system? Any C library
or system call can tell me which *.so or *.sl is active? Can the
setting of LD_LIBRARY_PATH guanrantee that the correct one is
executed?

2> In MS-WINDOWS, once a DLL is loaded by one allication, this DLL
will be used by the subsequent appication. Does UNIX have the same
mechanism?

3> Or in UNIX the application always load the dynamic linking library
according to the paths specified by LD_LIBRARY_PATH.

4> Can the applications belonged to different user share the same
dynamic linking library? If not, how could it be called shared
library???

And your C question is?
[hint: on news:comp.unix.programmer this might be appropriate]

--ag

--
Artie Gold -- Austin, Texas

Nov 13 '05 #2
ks*****@evercad.com (K.S.Liang) wrote:
# Hi all,
#
# 1> If there are more than one dynamic linking libraries in the file
# system, how do I know which one is loaded into system? Any C library
# or system call can tell me which *.so or *.sl is active? Can the
# setting of LD_LIBRARY_PATH guanrantee that the correct one is
# executed?

Different unices have different mechanisms and different guarentees. There's no
universal unix answer. Darwin, for example, allows one path to the library to
be compiled into the code, and then searches a predetermined list of
Library directories.

# 2> In MS-WINDOWS, once a DLL is loaded by one allication, this DLL
# will be used by the subsequent appication. Does UNIX have the same
# mechanism?

Sometimes different members of a library may be crosslinked to prefer other members
of the same library rather than a previously loaded definition of a symbol. Depends
on the unix and how the libraries are constructed.

# 3> Or in UNIX the application always load the dynamic linking library
# according to the paths specified by LD_LIBRARY_PATH.

Not all unices even look at any environmental variable.

# 4> Can the applications belonged to different user share the same
# dynamic linking library? If not, how could it be called shared
# library???

A library or executable file consists of read only pages and pages that can be
modified by the program. Usual virtual memory semantics require changes to
pages to be isolated from other processes: these pages cannot be shared by
different processes. Read only pages will always be the same in every process
that loads them: they can be shared. The shared means more than one process can
have the same page in their different address spaces. Read only pages of executables
can also be shared.

A shared library is either loaded at the same vm address everytime (which can lead
to conflicts if two libraries load at the address), or the library code is compiled
so that its code pages can be loaded at any addresses without modifying the code
(using PC-relative branches or jumps through special linkage pages).

Static library code is copied into the executable file. The code can contain
relocatable addresses that are modified as it is loaded into the executable, modifying
the code pages when copied into the executable, but not modified while the
executable itself is running. As far as I know static libraries are no longer
linked dynamically in a running program: shared libraries can do this better
and cheaper. The static library file itself need not be present when the executable
is running: all relevant parts of library have already been incorporated into the
executable.

Different applications belonging to different users can share the same dynamic
library pages. Most unix programs use the C library; the kernel can arrange it so
there is only single copy of the library code in vm. This can greatly reduce the
number of pages required to run programs. Different applications of the same user
can share library pages. The same application in different processes (different
or same users) can share the executable pages.

--
Derk Gwen http://derkgwen.250free.com/html/index.html
JUSTICE!
Justice is dead.
Nov 13 '05 #3
Derk Gwen <de******@hotpop.com> wrote:
ks*****@evercad.com (K.S.Liang) wrote:

[...]
4> Can the applications belonged to different user share the same
dynamic linking library? If not, how could it be called shared
library???


A library or executable file consists of read only pages and pages that can be
modified by the program. Usual virtual memory semantics require changes to
pages to be isolated from other processes: these pages cannot be shared by
different processes. Read only pages will always be the same in every process
that loads them: they can be shared.


Even writeable pages can be shared between processes, if the OS supports
Copy-On-Write semantics for pages.

- Kevin.

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: iceColdFire | last post by:
Hi, Can someone highlight the difference between static library and bynamic library...and how do .lib and .dll files come up in the picture... Thanks, a.a.cpp++ :-)
21
by: Marky C | last post by:
atof is not working. double a = atof("12.345"); a gets set to 12.000 I am working on a toshiba micro. The data map has no space allocated to it for dynamic memory. Does anyone have an...
5
by: markus | last post by:
Hi, I have a question that deals with the standard c library VS (Unix) system calls. The question is: which header files (and functions) are part of the C library and which header files (and...
1
by: draco | last post by:
Hi, Let's say I have a dynamic library libapple.so with a method applemethod() which expects a filename string. I call this method from main() which is in the file foo.c. Now foo.c and apple.so...
7
by: Tim | last post by:
When there is a need to pass some dynamic information between 2 managed assemblies, the "Dictionary object" in Generic form can be used as a method parameter to pass the information. The...
4
by: yhebib | last post by:
Hello All, I've been browsing and reading all articles I could find on technet ,msdn and other knowledgeable sources to understand the issue I'm dealing with. However, I did not find so far how...
11
by: toton | last post by:
Hi, I have little confusion about static memory allocation & dynamic allocation for a cluss member. I have class like class Bar{ public: explicit Bar(){ cout<<"bar default"<<endl; }
0
by: OverTheTop | last post by:
All the usual Newbie stuff applies... I have a Windows2000 Server with ActivePerl and a module (DBD-Interbase) that worked fine. Trying to duplicate the environment on Windows2003 Server for...
1
by: Rajeshwaran | last post by:
Hi, I have an application which uses 4 libraries.(cppunit, factory, awscomm, pthread) I need to statically link the cppunit library and dynamically link the other libraries. Is this possible?...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.