Building a shared library on Fedora Core 2 ?

shane crowe ebm at ireland.com
Thu Nov 18 10:38:28 UTC 2004


Hi all,

I'm new here, so I hope this is a relevant post...

I have a command-line C program compiled under gcc on my 64 bit fedora core 2 box, all working very well.
Now I wish to package the C source into a shared object, to be called from another java program (java 1.5 for 64 bit linux)

I build my shared object as follows:

gcc -c -fPIC <c source files>
gcc -fPIC -shared <obj files> -o liblibrary.so

...which all works fine. I then put the .so into a place it can be found at runtime.

However, when I run the java project, it successfully kicks off the .so, but crashes in the middle of one of my C routines.

I have recompiled and run the same project on Windows using a DLL, with success. So my suspicions are that I have somehow incorrectly built my .so. 

Any help is greatly appreciated,

Shane





More information about the fedora-list mailing list