Shared library (compilation question)

Ian Malone ibmalone at gmail.com
Wed May 9 11:38:44 UTC 2007


On 09/05/07, Luc MAIGNAN <luc.maignan at winxpert.com> wrote:
> Hi all,
>
> I have a function written in C. I would like make it shared in a shared
> library (.so), so it can be called from an external program. Can anyone
> give me parameters of gcc to export my function and generate a .so ?
>
> ANy help would be appreciated
>

gcc -shared -o libMYLIBRARYNAME.so <etc>

"lib" isn't compulsory, but used when resolving names.

Depending what you're going to use it for and where
it's going to live you may also need to investigate
the LD_LIBRARY_PATH environment variable.
(If the library isn't going into a standard place then
this is needed to tell the system where to look for it,
but it isn't recommended for general use.)

-- 
imalone




More information about the fedora-list mailing list