473,750 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
+ 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 4268
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******@hotpo p.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
3832
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
2284
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 idea? Could it be due to the lack of dynamic
5
3545
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 function calls) are part of the (Unix) system calls. The cause of my confusion is that for example stdio.h is considered
1
1361
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 are in different directories, and the user calls foo.c with a relative pathname to the file. My question is how do I make sure that applemethod knows where this file is from the realtive pathname? foo.c:
7
10238
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 information that needs to be passed can be stored as Key-Value pairs, and the method signature remains the same. That way, handling future requirements of passing additional details to the callee can be handled without changing the method signature. Is...
4
4450
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 to fix that. Investigations are still under progress and I hope you'll be able to give hints or feedback that will drive me to the solution. The applications I'm working on until the next release that will soon
11
3051
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
5777
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 future upgrade, and this module won't work (other Perl scripts in IIS6 are OK, just not this Interbase module, which is critical). The error comes from Dynaloader.pm file, which I've read through, and it says that it's a generic message about external...
1
1713
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? If so please let me know how. Thanks Rajesh
0
8999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9575
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9394
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9338
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8260
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.