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

This is a discussion on "-DD64" compile flag not supported with JNI with jdk 6 on hpuxB.11.11 - HP UX ; I followed the instructions http://docs.hp.com/en/JAVAPROGUIDE/J...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 \ > ...

+ Reply to Thread
Results 1 to 4 of 4

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

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

    I followed the instructions
    http://docs.hp.com/en/JAVAPROGUIDE/J...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

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

    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/J...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-...m#callinghpacc

    /* NOTE: In 64-bit mode, you MUST NOT call _main. */
    #if !defined(__LP64__) && !defined(__ia64)
    _main();
    #endif

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

    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/J...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-...m#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
    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;
    }


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

    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. :-(

+ Reply to Thread