public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hatt Tom <net.study.sea@gmail.com>
To: Sam Varshavchik <mrsam@courier-mta.com>, gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: reload .so without restarting process
Date: Mon, 02 Dec 2013 05:27:00 -0000	[thread overview]
Message-ID: <CAHvbk5OVSk60DsJhXuR6MfW9WOPXfn9MFLo2sHE-Ar7=P+gRxw@mail.gmail.com> (raw)
In-Reply-To: <cone.1385955381.779839.10275.1000@monster.email-scan.com>

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@courier-mta.com>:
> 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@courier-mta.com>:
>> > 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!

  parent reply	other threads:[~2013-12-02  5:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-01 14:15 Hatt Tom
2013-12-01 14:28 ` Sam Varshavchik
2013-12-02  3:01   ` Hatt Tom
2013-12-02  3:36     ` Sam Varshavchik
2013-12-02  4:59       ` Hatt Tom
2013-12-02 11:52         ` Sam Varshavchik
2013-12-02  5:27       ` Hatt Tom [this message]
2013-12-02  6:24         ` Nicholas Mc Guire
2013-12-02  6:49           ` Hatt Tom
2013-12-02 11:55             ` Sam Varshavchik
2013-12-03  1:23               ` Hatt Tom
2013-12-03  2:05                 ` Sam Varshavchik
2013-12-03  2:28                   ` Hatt Tom
2013-12-03  3:17                     ` Sam Varshavchik
2013-12-05  2:02                       ` Hatt Tom
2013-12-05  2:14                         ` Jonathan Wakely
2013-12-05  5:24                           ` Hatt Tom
2013-12-05 11:55                         ` Sam Varshavchik
2013-12-05 14:02                           ` net.study.sea
2013-12-13  1:13                             ` Ángel González

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHvbk5OVSk60DsJhXuR6MfW9WOPXfn9MFLo2sHE-Ar7=P+gRxw@mail.gmail.com' \
    --to=net.study.sea@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=mrsam@courier-mta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).