Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > "-DD64" compile flag not supported with JNI with jdk 6 on hpuxB.11.11

Reply
Thread Tools

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

 
 
TsanChung
Guest
Posts: n/a
 
      09-08-2008
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
 
Reply With Quote
 
 
 
 
Dennis Handly
Guest
Posts: n/a
 
      09-08-2008
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
 
Reply With Quote
 
 
 
 
TsanChung
Guest
Posts: n/a
 
      09-09-2008
On Sep 8, 7:25*pm, Dennis Handly <(E-Mail Removed)> 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 <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;
}

 
Reply With Quote
 
Dennis Handly
Guest
Posts: n/a
 
      09-09-2008
TsanChung wrote:
> On Sep 8, 7:25 pm, Dennis Handly <(E-Mail Removed)> 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 With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JNI program work with jdk 5 but not jdk6 on aix 5.3 TsanChung Java 4 09-26-2008 02:43 PM
JNI program work with 32bit but not 64bit JVM on jdk 1.6 & aix 5.3 TsanChung Java 7 09-18-2008 12:47 PM
cant compile on linux system.cant compile on cant compile onlinux system. Nagaraj C++ 1 03-01-2007 11:18 AM
SHA Message Digest Algo not supported by IBM JDK Raga Java 0 07-31-2006 08:56 AM
Help with converting IDS from JDK 1.1 to JDK 1.4 Babar Java 1 05-20-2004 09:11 PM



Advertisments