From: Kenny McCormack on
I have an app that uses dlsym() to lookup functions and then executes
them. Usually, the function being lookedup is in the system libraries
(i.e., libc) - i.e., it is a normal function, like read() or write(),
etc. However, sometimes, the function being lookedup is actually in the
app itself - i.e., we use the dlsym mechanism to invoke a "local"
function.

The former case works fine in all 3 OSs, but...
The later case (where the function is in the app itself) works fine in
Linux and Solaris, but fails (the dlsym() function fails with a "symbol
not found" error) in MacOSX.

Any ideas why? How to fix?

--
Just for a change of pace, this sig is *not* an obscure reference to
comp.lang.c...

From: David Schwartz on
On Jul 27, 2:26 pm, gaze...(a)shell.xmission.com (Kenny McCormack)
wrote:
> I have an app that uses dlsym() to lookup functions and then executes
> them.  Usually, the function being lookedup is in the system libraries
> (i.e., libc) - i.e., it is a normal function, like read() or write(),
> etc.  However, sometimes, the function being lookedup is actually in the
> app itself - i.e., we use the dlsym mechanism to invoke a "local"
> function.
>
> The former case works fine in all 3 OSs, but...
> The later case (where the function is in the app itself) works fine in
> Linux and Solaris, but fails (the dlsym() function fails with a "symbol
> not found" error) in MacOSX.
>
> Any ideas why?  How to fix?

Can you post a complete, compilable example that fails on OSX? And can
you include the command line you used to compile/link it?

DS
From: Golden California Girls on
Kenny McCormack wrote:
> I have an app that uses dlsym() to lookup functions and then executes
> them. Usually, the function being lookedup is in the system libraries
> (i.e., libc) - i.e., it is a normal function, like read() or write(),
> etc. However, sometimes, the function being lookedup is actually in the
> app itself - i.e., we use the dlsym mechanism to invoke a "local"
> function.
>
> The former case works fine in all 3 OSs, but...
> The later case (where the function is in the app itself) works fine in
> Linux and Solaris, but fails (the dlsym() function fails with a "symbol
> not found" error) in MacOSX.
>
> Any ideas why? How to fix?
>

Not sure if it is the same issue, but I did find one time that in a MacOSX
program I was working on, a local symbol was automatically changed behind
my back. IIRC an underscore had been prepended. Before you go crazy
compile with debugging symbols on and dump the generated symbol table to be
sure it isn't the same thing.