And also : why cannot I dlclose a .so that I've linked my executable to, in the usual fashion. is it because the reference count of that .so would not alwayes to be zero ? It seems puzzling to me ? 2013/12/2 Sam Varshavchik <mrsam@xxxxxxxxxxxxxxx>: > Hatt Tom writes: > >> Thanks ! >> I have tried this method ,but the problem is the main process still >> use old functions , though I have dlclose that .so and then load the >> newer one . >> >> >> what is the reason ?How could I fix this ? > > > In order for you to be able to dlclose a .so, it must've been initially > opened with dlopen. > > You cannot dlclose a .so that you've linked your executable to, in the usual > fashion. > > If you want to be able to reload a .so, you must manually open it with > dlopen(), and then use dlsym() to look up the functions' addresses in the > .so. > > After you dlclose() the .so, and dlopen() it back again you must then use > dlsym() again to look up all the functions' addresses. Even functions that > have not been changed, in the new version of your .so, might now be loaded > at a completely different address. > > > >> >> >> 2013/12/1 Sam Varshavchik <mrsam@xxxxxxxxxxxxxxx>: >> > Hatt Tom writes: >> > >> >> hi: >> >> >> >> Is it possible to reload .so file withour restarting thr process ? >> >> >> >> As I need to update some functions in my .so , and it is not >> >> pleasure to interrupt the main process . is there way to achive this? >> > >> > >> > Only if you, yourself has manually loaded the .so with dlopen(). Then, >> > you >> > just dlclose() and dlopen() it again. >> > >> > man dlopen >> > >> > >> >> >> >> -- >> Best Regards! -- Best Regards!