Originally Posted by shrivaths
I am working on JNI(Java Native Interface) on fedora 7 where i need to create a .so file of .c
The main thing you need is -shared
on the gcc command line.
I'm not sure what else you might need: Switches specific to JNI? Specific the version of gcc you're using (what version is that?) Specific to your architecture (I expect X86, but if it is X86_64, that requires some extra switches).
Originally Posted by schneidz
you can use gcc -c to create a shared object.
No. that is to create a .o file (an object file) not a .so file (shared object file).
Originally Posted by John VV
First fedora 7 is OLD and unsupported . Please install the current fedora 12
Interesting point. But I don't know how important that is. The version of GCC may be a more relevent question.
That is harder than you might expect. The man page for gcc is so disorganised, incomplete and misleading to be basically worthless. The info documentation for GCC is terribly hard to navigate.
If you must read GCC documentation, I find the online HTML version to be at least practical to navigate, which compensates some for the poor organization. I don't know if that is even available for whatever old version of GCC the OP is using. I'm using 4.3.2, documented at:
If you knew a moderate amount about GCC, but not much about how it is documented, you would click from there into GCC Command Options
and from there into Options Controlling the Kind of Output
and try to find where it tells you how to chose .so as the kind of output. No such luck.
switch is documented (sort of) in the section on Options for Linking