How to create .so file on fedora 7?
Hello friends,
I am working on JNI(Java Native Interface) on fedora 7 where i need to create a .so file of .c.(For example Hello.c to Hello.so). But i am not getting options to be used with the "cc" command. So please tell me the option or the command. |
this probably should go in the programming forum.
i know with c you can use gcc -c to create a shared object. keep in mind that object code simply doesnt have an enfty point. |
First fedora 7 is OLD and unsupported . Please install the current fedora 12
"example Hello.c to Hello.so)." read the gcc docs so you want to make an executable lib ( .o) and not a normal executable file |
Quote:
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). Quote:
Quote:
Quote:
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: http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/index.html 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. The -shared switch is documented (sort of) in the section on Options for Linking |
Thank you guys for your support
I got the so file using cc with -c option, and now i want to set the "library path". But with some reference i got the information about the "ld.so.conf" where i need to edit the new path and have to update the ld.so.cache file. I did the same thing but i am not able to execute that "ld.so.cache". |
I think you are way off track at the moment:
Quote:
A .so for JNI is not loaded when the executable (java) is loaded. It is loaded later by that executable. So the search rules that apply to .so files loaded with an executable don't apply. Java has its own, different, search rules for the .so files it loads later for JNI. Quote:
First, because the .so for JNI is found by different rules. Second, because you usually don't want to edit ld.so.conf even for .so files found the common way: You either want to put the .so where it would be found normally or change the LD_LIBRARY_PATH environment variable. Quote:
Quote:
|
Quote:
|
All times are GMT -5. The time now is 09:12 PM. |