"-DD64" compile flag not supported with JNI with jdk 6 on hpuxB.11.11

Discussion in 'Java' started by TsanChung, Sep 8, 2008.

  1. TsanChung

    TsanChung Guest

    I followed the instructions
    http://docs.hp.com/en/JAVAPROGUIDE/JNI_java2.html#using_JNI
    to use JNI with jdk 6 on hpux B.11.11.

    The cpp programs aCCImpl.C and TestJava2CallingNative.java work as
    expected.
    $ aCC +z +u4 -c -mt -I/usr/java/include -I/usr/java/include/hp-ux
    aCCImpl.C
    $ aCC -b -o libaCCImpl.sl aCCImpl.o \
    > -lstd -lstream -lCsup -lm

    $ java TestJava2CallingNative aCCImpl
    Library cImpl successfully loaded
    Calling sayHelloWorld
    C says HelloWorld via stdio
    All done

    However, if I add the "-DD64" flag to my compilation then the java
    program has the following error.
    Please help to fix this error.
    Thanks.

    $ aCC +DD64 +z +u4 -c -mt -I/usr/java/include -I/usr/java/include/hp-
    ux aCCImpl.C
    $ aCC +DD64 -b -o libaCCImpl.sl aCCImpl.o \
    > -lstd -lstream -lCsup -lm

    $ java -d64 TestJava2CallingNative aCCImpl
    Library aCCImpl successfully loaded
    initialize C++ runtime
    /usr/lib/pa20_64/dld.sl: Unsatisfied code symbol '_main' in load
    module '/home/tcma/jnihp/cpp64/libaCCImpl.sl'.
    Killed

    $ uname -a
    HP-UX hp1 B.11.11 U 9000/785

    $ aCC --version
    aCC: HP ANSI C++ B3910B A.03.50
     
    TsanChung, Sep 8, 2008
    #1
    1. Advertising

  2. TsanChung wrote:
    > I followed the instructions


    You didn't follow the aC++ instructions. See below.

    Please provide feedback on this page so they can fix it:
    > http://docs.hp.com/en/JAVAPROGUIDE/JNI_java2.html#using_JNI


    > /usr/lib/pa20_64/dld.sl: Unsatisfied code symbol '_main' in load
    > module '/home/tcma/jnihp/cpp64/libaCCImpl.sl'.


    http://www.docs.hp.com/en/7762/5991-4874/otherlangs.htm#callinghpacc

    /* NOTE: In 64-bit mode, you MUST NOT call _main. */
    #if !defined(__LP64__) && !defined(__ia64)
    _main();
    #endif
     
    Dennis Handly, Sep 9, 2008
    #2
    1. Advertising

  3. TsanChung

    TsanChung Guest

    On Sep 8, 7:25 pm, Dennis Handly <> wrote:
    > TsanChung wrote:
    > > I followed the instructions

    >
    > You didn't follow the aC++ instructions.  See below.
    >
    > Please provide feedback on this page so they can fix it:


    How to provide feedback on this page?

    >
    > >http://docs.hp.com/en/JAVAPROGUIDE/JNI_java2.html#using_JNI
    > > /usr/lib/pa20_64/dld.sl: Unsatisfied code symbol '_main' in load
    > > module '/home/tcma/jnihp/cpp64/libaCCImpl.sl'.

    >
    > http://www.docs.hp.com/en/7762/5991-4874/otherlangs.htm#callinghpacc
    >
    > /* NOTE: In 64-bit mode, you MUST NOT call _main. */
    > #if !defined(__LP64__) && !defined(__ia64)
    >       _main();
    > #endif


    Following your advice, it is working now.
    Thanks!
    aCCImpl.C is changed as follows.
    //
    // File aCCImpl.C
    //
    #include "TestJava2CallingNative.h"
    #include <iostream.h>
    extern "C" {
    void _main();
    }
    JNIEXPORT void JNICALL
    Java_TestJava2CallingNative_initialize(JNIEnv *, jclass)
    {
    /* NOTE: In 64-bit mode, you MUST NOT call _main. */
    #if !defined(__LP64__) && !defined(__ia64)
    _main();
    #endif
    }
    JNIEXPORT void JNICALL
    Java_TestJava2CallingNative_sayHelloWorld(JNIEnv *, jclass)
    {
    cout << "aC++ says HelloWorld via iostreams"
    << endl;
    }
     
    TsanChung, Sep 9, 2008
    #3
  4. TsanChung wrote:
    > On Sep 8, 7:25 pm, Dennis Handly <> wrote:
    >> Please provide feedback on this page so they can fix it:

    >
    > How to provide feedback on this page?
    >
    >>> http://docs.hp.com/en/JAVAPROGUIDE/JNI_java2.html


    At the bottom of this page is a feedback link:

    Please let us know additional information you'd like to see in the
    programmer's guide.

    You can mention my name. Unfortunately a year ago when I reviewed it, I
    didn't notice the _main issue. :-(
     
    Dennis Handly, Sep 9, 2008
    #4
    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. Babar
    Replies:
    1
    Views:
    481
    Chris Smith
    May 20, 2004
  2. Thomas G. Marshall
    Replies:
    5
    Views:
    861
    Thomas G. Marshall
    Aug 6, 2004
  3. Raga
    Replies:
    0
    Views:
    497
  4. TsanChung
    Replies:
    7
    Views:
    1,734
    TsanChung
    Sep 18, 2008
  5. TsanChung
    Replies:
    4
    Views:
    1,111
    TsanChung
    Sep 26, 2008
Loading...

Share This Page