shared libraries

Dave Smith dave at thesmithfam.org
Mon Mar 10 21:59:05 MDT 2008


Andres Gonzalez wrote:
> My question is about the utility "strip"   If I use strip on the
> shared library, then nm reports that there are no symbols in the .so
> library.  But I can still use the stripped library and link to it.
>
> How is this so?  If strip removes the symbols, how can you then link
> other code to it?
>   

Good question. Isn't it amazing how we place so much of the 
compiler/linker world in the "voodoo" category (I know I do). I found 
this Apple man page on "strip" most helpful:

    
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/strip.1.html

In a nutshell I believe, though I haven't confirmed it, that if you 
strip a .so file, you will no longer be able to dlopen() it and call 
functions contained therein by name. However, as you have discovered, 
you will still be able to link against it, because the linker is smart 
about numerical offsets into the file and doesn't need named symbols. I 
will write some code in a moment to experiment with this, but I think 
that's the nutshell description.

I'll leave it to Byron or Michael to correct me, as I'm sure they will. :)

--Dave


More information about the PLUG mailing list