views:

90

answers:

1

I have created a shared library on linux x86. In creating it, I have statically linked in openssl. OpenSSL is only used internally however I see that the openssl symbols have been exported. This is causing problems for other libraries that need my library AND openssl because the wrong symbol can be loaded at runtime. Is there a way to prevent all of the openssl symbols from getting exported when I statically link it into my shared library?

Thanks, Mike

+1  A: 

Assuming you are using gcc, when linking your library, set -fvisibility=hidden and in your library source, mark all of the functions you want to be visible as extern. I think this should work as long as openssl has not declared their own functions extern.

I think if openssl has declared some symbols extern, you can manually force symbols to be hidden with pragmas.

There are other options involved. Check the gcc docs in the fvisibility section for a full explanation of what is available to you.

frankc