Main Page
Cookbook/Overview ImageMeister the jcprops file Licensing Binary Installation & Configuration [ Win · Mac · Nix · OSX ] Changes Public API Source Code Main Page Java [ Common · Win · Mac · Nix ] Native Code [ Common · Win · Mac · Nix ] Manifest Native Code Overviews [ Common · Win · Mac · Nix · Strings ] Macros [ General · Native Macros ] Walkthroughs [ Java only · Java and native ] Building [ Win · Mac · Nix · OSX ] Distribution Issues |
This file describes the macros and defines which are used to minimize the differences between the three native architectures supported by JConfig: JNI, JRI, and RNI. Except as noted, these macros are not platform specific.
As an example:
These macros are divided into two categories:
The evaluation of each of these macros depends on several factors:
These macros are generally used in two places: in the stub files (AppUtilsMSVM.cpp, etc.) and in some of the common files (CStrA.cpp, etc.)
JSTRING JINT JBYTEARRAY JINTARRAY JLONGARRAY JOBJECTARRAY java's basic types CHECKNULL(a) if 'a' is null, sets 'theErr' and jumps to 'bail' CHECKSIZE( a, b ) if the array 'a' is null, or has less than 'b' elements, sets 'theErr' and jumps to 'bail' SETINTARRAYREGION(a,b,c,d) SETLONGARRAYREGION(a,b,c,d) sets elements of the array 'a' from the buffer 'd' 'b' is the start index of 'a' 'c' is the number of elements to set GETBYTEARRAYLEN(a) GETINTARRAYLEN(a) GETOBJECTARRAYLEN(a) returns the length of 'a' LOCKBYTEARRAY(a) LOCKINTARRAY(a) returns a pointer to the elements of the 'a' array. Must be followed by a call to the corresponding 'UNLOCK...' routine UNLOCKBYTEARRAY(a,b) UNLOCKINTARRAY(a,b) call these after calling the 'LOCK...' routines. a is the Java array b is the value returned from the 'LOCK...' routine NOTE: don't change 'b' itself, only what it points to: b = LOCK...(a); ++b; // BAD UNLOCK...(a,b) GETSTRARRAYELEMENT( a, b ) GETOBJECTARRAYELEMENT( a, b ) 'a' is an object array returns the object/JSTRING at index 'b' SETSTRARRAYELEMENT(a,b,c) SETOBJECTARRAYELEMENT( a, b, c ) 'a' is an object array 'b' is the index to set 'c' is the object/JSTRING to put at 'b' SETJINT1(a,b) SETJINT2(a,b,c) SETJINT4(a,b,c,d,e) GETJINT2(a,b,c) SETJLONG1(a,b) SETJLONG2(a,b,c) 'a' is a JINT or JLONG array the remaining arguments will be stored starting at index 0 in this array for example, SETJINT2( jintArray, xx, yy ) will store xx at jintArray[ 0 ] and yy at jintArray[ 1 ]
EXP FUNC(pkg,clz,mth) SFUNC(pkg,clz,mth) represents the header of each native stub. 'SFUNC' is used if the native routine is declared in Java as a static method, 'FUNC' otherwise. SEH_EXP SEH_FUNC(pkg,clz,mth) SEH_SFUNC(pkg,clz,mth) SEH_TRY SEH_EXCEPT(a) CALL_INNER(a) INNER_PREFIX used only on Windows, these allow each native stub to be wrapped by an SEH handler.