Using Jni to access C++ api in Linux.

Discussion in 'Java' started by gowda, Jun 13, 2006.

  1. gowda

    gowda Guest

    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.
     
    gowda, Jun 13, 2006
    #1
    1. Advertising

  2. On 13 Jun 2006 02:12:16 -0700, gowda wrote:
    > 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

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
     
    Gordon Beaton, Jun 13, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley

    IBM's JNI fails where Sun's JNI works

    Alex Hunsley, Nov 3, 2003, in forum: Java
    Replies:
    4
    Views:
    879
    Alex Hunsley
    Nov 4, 2003
  2. Pasturel Jean-Louis

    Porting JNI Windows under JNI LINUX + Wine ?

    Pasturel Jean-Louis, Feb 29, 2004, in forum: Java
    Replies:
    5
    Views:
    943
    Pasturel Jean-Louis
    Mar 3, 2004
  3. vasanth
    Replies:
    0
    Views:
    2,780
    vasanth
    Jan 25, 2005
  4. vasanth
    Replies:
    0
    Views:
    638
    vasanth
    Jan 25, 2005
  5. Ed
    Replies:
    2
    Views:
    1,084
Loading...

Share This Page