> Date: Tue, 2 Apr 2002 11:05:52 -0800
> From: Alfred Perlstein <[EMAIL PROTECTED]>


> 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 <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
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 <[EMAIL PROTECTED]>, or you are likely to
be blocked.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to