From owner-freebsd-stable Fri Jul 21 22:37:48 2000 Delivered-To: freebsd-stable@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id DE0A837BA35 for ; Fri, 21 Jul 2000 22:36:56 -0700 (PDT) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.3/8.9.3) with ESMTP id WAA24201; Fri, 21 Jul 2000 22:36:55 -0700 (PDT) (envelope-from jdp@polstra.com) From: John Polstra Received: (from jdp@localhost) by vashon.polstra.com (8.9.3/8.9.1) id WAA47633; Fri, 21 Jul 2000 22:36:54 -0700 (PDT) (envelope-from jdp@polstra.com) Date: Fri, 21 Jul 2000 22:36:54 -0700 (PDT) Message-Id: <200007220536.WAA47633@vashon.polstra.com> To: Raymond.Wiker@fast.no Subject: Re: dlopen() and friends from a statically-linked binary? In-Reply-To: <14712.8524.305147.704022@raw.gren.fast.no> References: <14712.8524.305147.704022@raw.gren.fast.no> Organization: Polstra & Co., Seattle, WA Cc: stable@freebsd.org Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article <14712.8524.305147.704022@raw.gren.fast.no>, Raymond Wiker 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