NonStop Server for Java 6.0 Programmer's Reference
◦ SPT_ENDTRANSACTION()
◦ SPT_RESUMETRANSACTION()
NOTE: The Open System Services Programmer's Guide states that the maximum
concurrent transactions allowed in a process is 100; however, the JVM is an exception
where the maximum allowed is 1000 as described under “Controlling Maximum
Concurrent Transactions” (page 72).
• When calling a C or C++ routine, where the function passes or returns parameters of type
float or double, NonStop Server for Java 6.0 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” (page 46).
• When using the JNI_OnLoad function, use the following format:
jint JNI_OnLoad(JavaVM *vm, void *reserved);
• The JNI_OnUnload function is supported by NonStop Server for Java 6.0 on NS-series
servers, but not supported on S-series servers.
When naming library files, observe the following rules:
• Do not use names that begin with Tandem, tandem , or tdm .
• NonStop Server for Java 6.0 requires that all DLLs be named with a prefix lib and a sufix
.so. So you must name your DLL as follows:
libname.so
where (name) signifies the string that is passed to the System.loadLibrary
() call. libname.so
The remainder of this subsection explains:
• “Calling C or C++ Methods from Java” (page 44)
• “Calling Java Methods from C or C++” (page 45)
• “Linker and Compiler Options” (page 45)
For more information about JNI, see the Sun Microsystems JNI document
(http://docs.oracle.com/javase/6/docs/technotes/guides/jni/index.html).
Calling C or C++ Methods from Java
To call C or C++ methods from Java, follow these steps:
1. Compile the Java code.
2. Use javah to generate header files. The function declarations listed in the generated header
file are those that must be exported by the user-JNI DLL. To export functions, either specify
export$ in the function definition or use the linker option -export_all.
3. Compile the C or C++ code. C++ code must be compiled using the following compiler
command line options: -Wversion2 or -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
44 Implementation Specifics










