NonStop Server for Java Programmer's Reference (NSJ 4.2+)

double, NonStop Server for Java 4 performs no conversion. All float and double values remain in IEEE
floating-point format when crossing the JNI boundary. For more information, see IEEE Floating-Point
Implementation.
When using the JNI_OnLoad function you must use the following name:
JNI_OnLoad_libname
where libname is the name of the library that your program passed to the
System.loadLibrary function.
The JNI_OnUnload function is not supported by NonStop Server for Java 4.
When naming library files, observe the following rules:
Do not use names that begin with Tandem, tandem, or tdm.
You can create libraries as an archive file whose name ends in .a or a relinkable library file whose name
ends in .lib. HP recommends using a relinkable file.
Do not use the same file name for more than one archive file, even if the two archive files are in different
directories. This naming restriction does not apply to relinkable library files.
The remainder of this subsection explains:
Calling C or C++ Methods from Java
Calling Java Methods from C or C++
Using the compaq.liblist System Property
Linker and Compiler Options
For more information about JNI, see the Sun Microsystems JNI document
(http://java.sun.com/j2se/1.4.2/docs/guide/jni/index.html).
Calling C or C++ Methods from Java
To call C or C++ methods from Java, follow these steps:
Compile the Java code.1.
Use javah to generate header files.2.
Compile the C or C++ code. C++ code must be compiled using the following compiler command-line
options: -Wversion3 and -WIEEE_float.
If the native code has large variables on the stack, calling this native code might exceed the default stack
space provided for each thread. If the native code exceeds the amount of stack space allocated for it,
unpredictable results can occur. To prevent overflowing the available stack space, consider allocating large
variables on the heap rather than using the stack. Otherwise, you can increase the default stack size for each
thread by specifying the -Xss option when starting java. This option increases the stack size for every
thread. For more information about the -Xss option, see java in the NonStop Server for Java Tools
Reference Pages.
3.
Create either a relinkable library (.lib) file or an archive library (.a) file and specify the linker option
set floattype IEEE_float.
4.
Place the newly created library (.a or .lib) file in install_dir/java_public_lib_jdk142.5.
Relink the Java virtual machine (JVM) by using the install_dir/install/Makefile. For more
information about the Makefile, see Using the Makefile to Link in Native Libraries.
6.
The javahjni demo shows an example of how to create a library file and link it in with a java executable. It
also shows using IEEE floating point.