LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 10-17-2011, 11:21 AM   #1
MANOHARNLINUX
LQ Newbie
 
Registered: Oct 2011
Posts: 9

Rep: Reputation: Disabled
dlclose() is not unloading library even if no references to that library in RHEL61


Hello All,
I am trying to write a piece of code to which perform following actions.
func()
{
f1. open library
f2. get symbol
f3. Run function
f4. close library
}
main()
{
1. func("libtest.so");
2. replace libtest.so with new version
3. func("libtest.so");
}

Question is.
In call #1, libtest.so of version1 is loaded and excuted the function from libtest.so and closed the library.
In #2, I am replacing the libtest.so with new version using system command and cp command.
in #3, calling func with new library, but I found that the older function is getting executed. new updated function is not being called. Seems dlclose has not unloaded the library.

Could you please tell me is this bug in RHEl61. I found that it works well in RHEL5.

Please help me.

Thanks
Manohar
 
Old 10-19-2011, 05:57 AM   #2
MANOHARNLINUX
LQ Newbie
 
Registered: Oct 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
can some one help to find whether it is bug or is this expected ?
 
Old 10-19-2011, 06:21 AM   #3
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,338

Rep: Reputation: 259Reputation: 259Reputation: 259
It will only close the library if there are no more references to it.

Did you try to open the second library version by a different name, so that any issue by the cp can be ruled out?
 
Old 10-19-2011, 06:28 AM   #4
MANOHARNLINUX
LQ Newbie
 
Registered: Oct 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
I am sure , here are no references to it.
I tried to open new library keeping in different location and giving complete path during dlopen. It worked. But this is not what I want to try.

But I was trying to unload the existing library, modify the link to point new library and calling dlopen. This way it is not working.
 
Old 10-31-2011, 02:01 AM   #5
MANOHARNLINUX
LQ Newbie
 
Registered: Oct 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Finally i found that one of system library is compiled with new option in RHEL61 which is default.
This was causing library not to unload ven if references are zero.

I make this library to be loaded during test program so that, it will be available for library which I planned to load dynamicaly.
Thu my problem resolved.

More information can be found at
http://docs.redhat.com/docs/en-US/Re...bility.objects

Thanks to all.
Manohar
 
Old 10-31-2011, 09:25 AM   #6
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,338

Rep: Reputation: 259Reputation: 259Reputation: 259
Thx for sharing your findings, so I’m warned.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ./configure problem for libsf library due to apparently missing libdb library. vectrum Linux - Software 6 08-05-2011 02:11 PM
ldd reports shared library missing, but library exists on disk athv_gr Linux - Newbie 7 05-13-2009 12:31 PM
install from source - unable to find the libcurl library - but library is installed pulper Linux - Newbie 2 02-23-2009 09:00 PM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 04:20 AM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 04:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration