public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hatt Tom <net.study.sea@gmail.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>, gcc-help <gcc-help@gcc.gnu.org>
Cc: Sam Varshavchik <mrsam@courier-mta.com>
Subject: Re: reload .so without restarting process
Date: Thu, 05 Dec 2013 05:24:00 -0000	[thread overview]
Message-ID: <CAHvbk5P3VXxpV61_9_ceL1_wvNXocANNd3s3_xNyFJKSFF+Wqw@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdS-4O3qdgsDFn6-hoibjE_zGtGk2tLNdY=CHZ2e8QDp6Q@mail.gmail.com>

Thanks for reply!

In my project ,  there need one script.so lib to be dynamiclly
modified and reloaded without reboot the process .the main process
uses its export functions ,I think dlopen and dlsym can do this .

At prevoius  ,I failed to achive this due to linking script.so lib
against executable   at compling time with "g++ -l "command ,it result
into dlclose can not remove script.so fully ,it would be because  the
reference count of script.so library  . So  the modification does not
work after reloading script.so .

After that failure , I tried to link script.so to middle.so ,than link
middle.so directly to executable .
It works ! script.so can be reloaded successfully , dlclose can remove
script.so fully .

During this work ,I find there are details of linking I should get to
be clear of .

Thanks!



 .

2013/12/5 Jonathan Wakely <jwakely.gcc@gmail.com>:
> On 5 December 2013 02:02, Hatt Tom wrote:
>>
>> So if I link that .so against my executable by "g++ -l " command
>> ,then I can not dlclose it fully in process at all  ?
>
> Right. Why is that a problem?  Why do you think you need to dlclose it?
>
>> Tp dlclose it  fully , I must not link it by compiler ,but manually
>> use dlopen and dlsym to resolve the external symbols  .
>>
>> But if so ,how to make  the compiler not to compalain "not reference
>> to symbol xxx" at compiling stage ?
>
> That means your program depends on symbols in the library directly, so
> you should link to it directly, and then you can't dlclose it.  But
> that should not be a problem.
>
> What are you trying to do?  Why can't you just let the linker do its
> job normally?



-- 
Best Regards!

  reply	other threads:[~2013-12-05  5:24 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
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 [this message]
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=CAHvbk5P3VXxpV61_9_ceL1_wvNXocANNd3s3_xNyFJKSFF+Wqw@mail.gmail.com \
    --to=net.study.sea@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --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).