Date: Fri, 21 Jul 2000 22:36:54 -0700 (PDT) From: John Polstra <jdp@polstra.com> To: Raymond.Wiker@fast.no Cc: stable@freebsd.org Subject: Re: dlopen() and friends from a statically-linked binary? Message-ID: <200007220536.WAA47633@vashon.polstra.com> In-Reply-To: <14712.8524.305147.704022@raw.gren.fast.no> References: <14712.8524.305147.704022@raw.gren.fast.no>
next in thread | previous in thread | raw e-mail | index | archive | help
In article <14712.8524.305147.704022@raw.gren.fast.no>,
Raymond Wiker <Raymond.Wiker@fast.no> wrote:
>
> Sorry about the confusion... the "main" symbol does not appear
> to work for this illustration (possibly because it doesn't come from a
> dynamic library?). If I try with "errno" instead, I get
As I mentioned in the other mail, in multithreaded programs there
will be no global symbol "errno" because it is a #define.
> raw : ~ $ ./dltest
> Handle: 0x2805e000, errno: 0x280f5cd4
> Handle: 0x0, errno: 0x0
> raw : ~ $
>
> --- according to the manpage for dlsym(), passing 0 for handle should
> have the same effect as passing 0 as the path to dlopen; i.e, to
> access the symbol table for the running program.
Not quite. The man page says
A null pointer supplied for path is interpreted as a reference to
the main executable of the process.
The "main executable" means just the main program. It doesn't include
any shared libraries which were loaded.
John
--
John Polstra jdp@polstra.com
John D. Polstra & Co., Inc. Seattle, Washington USA
"Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007220536.WAA47633>
