Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have 2 application lets say A1 ,A2 shared one shared object(lets say lib1) which loaded in application at runtime. A1 load lib1 using dlopen successfully. Now A2 wants to load library. Can A2?(as lib1 loaded in A1 address space). What if A1 load using RTLD_LOCAL. Can A2 load lib?

I am new in this field please give me directions

share|improve this question
2  
Shared libraries wouldn't be very useful if that didn't work. You'd only ever be able to start one non-static process on your computer, all others would fail because they can't load libc. –  Mat May 9 '12 at 5:35
add comment

1 Answer

Yes, of course. From the Wikipedia article on libraries:

A shared library or shared object is a file that is intended to be shared by executable files and further shared objects files

In other words, the whole reason they're called "shared" is because more than one executable is using them.

From the docs for RTLD_LOCAL:

Symbols defined in this library are not made available to resolve references in subsequently loaded libraries.

The RTLD_LOCAL flag to dlopen() simply indicates that when A1 loads lib1, if it defines, say, a function f1(), and then A1 loads lib2, it can't use the f1() from lib1, because that was loaded local.

share|improve this answer
    
The tldp.org "shared libraries" page will help a plenty. –  invert May 9 '12 at 8:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.