Date: Tue, 2 Apr 2002 19:58:35 +0000 (GMT) From: "E.B. Dreger" <eddy+public+spam@noc.everquick.net> To: Alfred Perlstein <bright@mu.org> Cc: hackers@freebsd.org Subject: Re: dlopen(), ld.so, and library wrappers Message-ID: <Pine.LNX.4.20.0204021914260.21594-100000@www.everquick.net> In-Reply-To: <20020402190552.GT93885@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> Date: Tue, 2 Apr 2002 11:05:52 -0800 > From: Alfred Perlstein <bright@mu.org> > From the dlopen manpage: I reread that right before initial post. > If dlsym() is called with the special handle RTLD_NEXT, then the search > for the symbol is limited to the shared objects which were loaded after > the one issuing the call to dlsym(). Thus, if the function is called Am I confused on loading order? I thought that linked libraries were loaded _before_ dlopen() shared objects. > from the main program, all the shared libraries are searched. If it is > called from a shared library, all subsequent shared libraries are > searched. RTLD_NEXT is useful for implementing wrappers around library > functions. For example, a wrapper function getpid() could access the > ``real'' getpid() with dlsym(RTLD_NEXT, "getpid"). > > How does that sound? So you're saying that: 1) Program foo contains function called getpid() 2) Program foo links with libc 3) foo.getpid uses dlsym(RTLD_NEXT, "getpid") to call libc.getpid 4) Shared object bar, loaded by foo, will receive a pointer to foo.getpid instead of libc.getpid when getpid is resolved. ??? If that'll work, great. But I didn't interpret the manpage that way. I read it as shared object bar being able to provide a wrapper for program foo, which is the _opposite_ of what I want. I'll try the above. If that doesn't do what I want, I'll see if I can restate more clearly. -- Eddy Brotsman & Dreger, Inc. - EverQuick Internet Division Phone: +1 (316) 794-8922 Wichita/(Inter)national Phone: +1 (785) 865-5885 Lawrence ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Date: Mon, 21 May 2001 11:23:58 +0000 (GMT) From: A Trap <blacklist@brics.com> To: blacklist@brics.com Subject: Please ignore this portion of my mail signature. These last few lines are a trap for address-harvesting spambots. Do NOT send mail to <blacklist@brics.com>, or you are likely to be blocked. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.20.0204021914260.21594-100000>