Using Jni to access C++ api in Linux.

G

gowda

hi all,
I am using JNI to access C++ api in Linux 9.0,but i dont know
how to create .so file in in Linux and also i dont know how to create
..lib file. if any body Knows please replay me.
Thanx in advance.
 
G

Gordon Beaton

I am using JNI to access C++ api in Linux 9.0,but i dont know how to
create .so file in in Linux and also i dont know how to create .lib
file.

Last I checked, Linux was up to about 2.6.16.

You don't need any .lib files.

To create a .so (shared object):

compile:

gcc -D_REENTRANT -fPIC
-I $JDK/include -I $JDK/include/linux
-c mylib.cpp

link:

gcc -shared mylib.o -o libmylib.so
(or maybe: gcc -shared mylib.o -lstdc++ -o libmylib.so)

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top