Prev: CASH FOR CISCO - I BUY USED AND NEW EQUIPMENT & LOTS MORE - SOFTWARE - MICROSOFT OFFICE, WINDOWS, SERVER, ADOBE
Next: function for searching a given path list for a given file
From: Kenny McCormack on 27 Jul 2010 17:26 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 27 Jul 2010 17:32 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 27 Jul 2010 21:03
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. |