Main /
JNAWikipedia says: "Java Native Access provides Java programs easy access to native shared libraries without using the Java Native Interface." Below are notes about JNA and some issues I faced. Resources
JNA Debugging
VaragsJNA Varargs"The C varargs function definition may be mapped to a Java varargs method definition. For example,
// Original C code extern int printf(const char* fmt, ...); // Equivalent JNA mapping interface CLibrary extends Library { int printf(String fmt, ...); }
"Varargs are not supported with direct mapping. The reason for this is that the direct mapping optimization does little to no translation of the incoming arguments, and any Object arguments would require introspection that defeats the purpose of the direct-mapping optimizations. It's also a lot more work than the benefit you get from implementing it."
"Hello, I'm new to JNA so first of all I would just like to say that I think it's very awesome"
"Now for my question. I'm using direct mapping and I read on the project front page that a few types of arrays are not supported (Pointer/String/WString/NativeMapped) but since I didn't see Object in there I thought I would try using Object varargs since that translates to an Object array in bytecode. That blew up in my face when the class initializer ran though, giving the following error: class [Ljava.lang.Object; is not a supported argument type Are arrays not supported at all as argument types when using direct mapping?"
"I was trying to map the standard printf function by the way, using the signature int printf(String s, Object[] args)"
"Such a callback is problematic because there is no way for the native callback stub to generically the types of the varargs parameters in order to convert them into java objects or primitives. The type information is (presumably) embedded in the format string, rather than in the objects themselves, and that information isn't available to JNA."
"Mapping the second arg to Pointer is actually more accurate, since it represents the position of the arguments on the stack. Since your application knows how to parse the format string, it can walk the argument stack and extract each value appropriately using Pointer.getXXX functions with appropriate offsets. Not particularly elegant, but it should work."
"For dll functions which have "char *" or "...", I can use String and Java Varargs as method parameters and it works like a charm."
"However, when I tried to do the same with Callback:"
typedef int (*PFKT) (char *format, ...); public interface PFKT extends Callback { int callback(String format, Object ... parameters); } "JNA claims that it cannot find the right conversion to "parameters". It would run if I declare "parameters" as Pointer instead, but it is evidently not the best solution."
Any pointers on the issue?
Patching JNA to work with Varargs CallBacksAs the libffi maintainers don't seem interested in supporting the functionality we require, here are patching instructions Resources
ProcedureA branch with the variadic extensions may be found at https://github.com/cxbrooks/jna. git clone https://github.com/cxbrooks/jna jna-cxbrooks cd jna-cxbrooks ant cp build/jna.jar $PTII/lib/jna-4.1.0-variadic.jar For each of the platforms, we need to create the appropriate native jar. See https://github.com/twall/jna/blob/master/www/ReleasingJNA.md. For Mac and Linux, do: git clone https://github.com/cxbrooks/jna jna-cxbrooks cd jna-cxbrooks ant git add lib/native/xxx.jar git commit -m "Updated for variadic support." lib/native/xxx.jar git push For Windows, see https://github.com/twall/jna/blob/master/www/WindowsDevelopmentEnvironment.md and follow the steps above. I used Cygwin. Below is how it was created. git clone https://github.com/twall/jna.git jna.git cd jna.git git checkout -b 4.1.0-variadic-closures 4.1.0 # create a local branch based off the 4.1.0 tag. patch -p1 < jna_4.0_diff.txt ant cp build/jna.jar $PTII/lib/jna-4.1.0-variadic.jar Below are the older instructions from D. Hogan git clone https://github.com/twall/jna.git jna.git cd jna.git git checkout -b 4.0-variadic-closures 4.0 # create a local branch based off the 4.0 tag. patch -p1 < jna_4.0_diff.txt ant cp build/jna.jar /path/to/ptII/lib/jna-4.0.0-custom.jar Building JNA from sourcesSee Patching JNA to work with Varargs CallBacks above. These instructions are for unpatched JNA trees. Building JNA Under Linux2015-02-23Under RHEL 6.x with Java 1.8, git clone https://github.com/twall/jna.git jna.git cd jna.git ant Failed with: [exec] gcc -m64 -W -Wall -Wno-unused -Wno-parentheses -fPIC -O2 -fno-omit-frame-pointer -fno-strict-aliasing -D_REENTRANT -DHAVE_PROTECTION -I"/usr/lib/jvm/jdk1.8.0_31/jre/../include" -I"/usr/lib/jvm/jdk1.8.0_31/jre/../include/linux" -I"/home/cxh/src/jna/jna.git/build/native-linux-x86-64" -I/home/cxh/src/jna/jna.git/build/native-linux-x86-64/libffi/include -DJNA_JNI_VERSION='"4.0.1"' -DCHECKSUM='"1a6047467b59e8748f975e03016ce3d9"' -c dispatch.c -o /home/cxh/src/jna/jna.git/build/native-linux-x86-64/dispatch.o [exec] In file included from dispatch.c:82: [exec] /usr/lib/jvm/jdk1.8.0_31/jre/../include/linux/jawt_md.h:29:22: error: X11/Xlib.h: No such file or directory [exec] /usr/lib/jvm/jdk1.8.0_31/jre/../include/linux/jawt_md.h:30:23: error: X11/Xutil.h: No such file or directory [exec] /usr/lib/jvm/jdk1.8.0_31/jre/../include/linux/jawt_md.h:31:27: error: X11/Intrinsic.h: No such file or directory [exec] In file included from dispatch.c:82: [exec] /usr/lib/jvm/jdk1.8.0_31/jre/../include/linux/jawt_md.h:43: error: expected specifier-qualifier-list before ‘Drawable’ [exec] dispatch.c: In function ‘Java_com_sun_jna_Native_getWindowHandle0’: [exec] dispatch.c:3004: error: ‘JAWT_X11DrawingSurfaceInfo’ has no member named ‘drawable’ [exec] make: *** [/home/cxh/src/jna/jna.git/build/native-linux-x86-64/dispatch.o] Error 1 Solution: Install X11 includes. sudo yum install libX11-devel.i686
native: [exec] gcc -m64 -W -Wall -Wno-unused -Wno-parentheses -fPIC -O2 -fno-omit-frame-pointer -fno-strict-aliasing -D_REENTRANT -DHAVE_PROTECTION -I"/usr/lib/jvm/jdk1.8.0_31/jre/../include" -I"/usr/lib/jvm/jdk1.8.0_31/jre/../include/linux" -I"/home/cxh/src/jna/jna.git/build/native-linux-x86-64" -I/home/cxh/src/jna/jna.git/build/native-linux-x86-64/libffi/include -DJNA_JNI_VERSION='"4.0.1"' -DCHECKSUM='"1a6047467b59e8748f975e03016ce3d9"' -c dispatch.c -o /home/cxh/src/jna/jna.git/build/native-linux-x86-64/dispatch.o [exec] In file included from dispatch.c:82: [exec] /usr/lib/jvm/jdk1.8.0_31/jre/../include/linux/jawt_md.h:31:27: error: X11/Intrinsic.h: No such file or directory [exec] make: *** [/home/cxh/src/jna/jna.git/build/native-linux-x86-64/dispatch.o] Error 1 Solution: sudo yum install libXt-devel.x86_64 Building JNA Under MacOSX with Java 1.7I wanted to build JNA under MacOSX so that I could do some debugging by modifying JNA. Sadly, Apple's Java story is rather lacking. I installed the Java 1.7 preview for Mac OS X and now I can't seem to compile code that uses When compiling jna, I get: [exec] dispatch.c:79:17: error: /System/Library/Frameworks/JavaVM.framework/Headers/jni.h: Too many levels of symbolic links This is because lrwxr-xr-x 1 root wheel 30 Jul 28 2011 /System/Library/Frameworks/JavaVM.framework/Headers/jni.h -> ../../CurrentJDK/Headers/jni.h I went to https://developer.apple.com/downloads/index.action downloaded "Java for Mac OS X 10.7 Developer Package" and installed it, and the problem was not solved. It appears that the issue here is that Apple's Java 1.6 used the Mac OS X "Frameworks" directory layout and Java 1.7 from Oracle uses the Java directory layout. Personally, I prefer the Java layout, since Java is "write once, test everywhere". Having a different directory layout under Mac OS X made things more difficult. I'm not sure how my directory structure was broken, but the directory Apple is no longer supporting Java and it is really starting to show. So, I decided to move forward with the Java 1.7 preview. I needed to remove the broken jni.h links, so I did: sudo -i cd /System/Library/Frameworks/JavaVM.framework mv Headers Headers.1.6 ln -s /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/include Headers Download the jna sources using git: git clone https://github.com/twall/jna.git 2. Run Problem: ant fails with "checking whether the C compiler works... no"(This problem did not occur when working with the JNA head on 2 Aug 2013) native: [exec] configure: WARNING: if you wanted to set the --build type, don't use --host. [exec] If a cross compiler is detected then cross compConfiguring libffi (amd64) [exec] ile mode will be used [exec] checking build system type... x86_64-apple-darwin11.3.0 [exec] checking host system type... x86_64-apple-darwin [exec] checking target system type... x86_64-apple-darwin [exec] checking for gsed... sed [exec] checking for a BSD-compatible install... /usr/bin/install -c [exec] checking whether build environment is sane... yes [exec] configure: error: in `/Users/cxh/src/jna/build-d64/native/libffi': [exec] configure: error: C compiler cannot create executables [exec] See `cchecking for amd64-apple-darwin-strip... no [exec] checking for strip... strip [exec] checking for a thread-safe mkdir -p... /Users/cxh/src/jnonfig.log' for more details [exec] a/native/libffi/install-sh -c -d [exec] checking for gawk... no [exec] checking for mawk... no [exec] checking for nawk... no [exec] checking for awk... awk [exec] checking whether make sets $(MAKE)... yes [exec] checking for amd64-apple-darwin-gcc... gcc -m64 [exec] checking whether the C compiler works... no [exec] make: *** [/Users/cxh/src/jna/build-d64/native/libffi/.libs/libffi.a] Error 77 What is happening here is that the Mac OS X Java 1.7.0_04-ea returns The solution is to do ant clean ant -DARCH=x86_64 Problem: "jni_md.h: No such file or directory"(This problem did not occur when working with the JNA head on 2 Aug 2013)
[exec] /System/Library/Frameworks/JavaVM.framework/Headers/jni.h:45:20: error: jni_md.h: No such file or directory My solution was to edit Change: ifeq ($(OS),darwin) JAVA_INCLUDES=-I/System/Library/Frameworks/JavaVM.framework/Headers to ifeq ($(OS),darwin) JAVA_INCLUDES=-I/System/Library/Frameworks/JavaVM.framework/Headers -I/System/Library/Frameworks/JavaVM.framework/Headers/darwin Rerun: ant clean ant -DARCH=x86_64 Problem: "‘JAWT_MacOSXDrawingSurfaceInfo’ undeclared"(This problem did not occur when working with the JNA head on 2 Aug 2013) [exec] dispatch.c:2865: error: ‘JAWT_MacOSXDrawingSurfaceInfo’ undeclared (first use in this function) See http://www.mail-archive.com/bsd-port-dev@openjdk.java.net/msg01291.html Workaround: Edit #elif __APPLE__ // WARNING: the view ref is not guaranteed to be stable except during // component paint (see jni_md.h) JAWT_MacOSXDrawingSurfaceInfo* mdsi = (JAWT_MacOSXDrawingSurfaceInfo*)dsi->platformInfo; to #elif __APPLEXXX__ // WARNING: the view ref is not guaranteed to be stable except during // component paint (see jni_md.h) JAWT_MacOSXDrawingSurfaceInfo* mdsi = (JAWT_MacOSXDrawingSurfaceInfo*)dsi->platformInfo; Rerun: ant clean ant -DARCH=x86_64 That seemed to do it! Test failures:Not all the tests pass: (This problem did not occur when working with the JNA head on 2 Aug 2013) [junit] Testcase: testLoadJAWT(com.sun.jna.LibraryLoadTest): Caused an ERROR [junit] Can't load JAWT [junit] java.lang.UnsatisfiedLinkError: Can't load JAWT [junit] at com.sun.jna.Native.getWindowHandle0(Native Method) [junit] at com.sun.jna.Native$AWT.getComponentID(Native.java:1766) [junit] at com.sun.jna.Native$AWT.getWindowID(Native.java:1742) [junit] at com.sun.jna.Native.getWindowPointer(Native.java:262) [junit] at com.sun.jna.LibraryLoadTest$AWT.loadJAWT(LibraryLoadTest.java:169) [junit] at com.sun.jna.LibraryLoadTest.testLoadJAWT(LibraryLoadTest.java:42) [junit] [junit] [junit] Testcase: testLoadLibraryWithUnicodeName(com.sun.jna.LibraryLoadTest): FAILED [junit] Expected JNA native library at /Users/cxh/src/jna/build-d64/native/libjnidispatch.dylib \ is missing [junit] junit.framework.AssertionFailedError: Expected JNA native library at /Users/cxh/src/jna/\ build-d64/native/libjnidispatch.dylib is missing [junit] at com.sun.jna.LibraryLoadTest.testLoadLibraryWithUnicodeName(LibraryLoadTest.java:9\ 6) I'm not sure about the above. (This problem did not occur when working with the JNA head on 2 Aug 2013) [junit] Testcase: testLaunchedUnderWebStart(com.sun.jna.WebStartTest): Caused an ERROR [junit] javaws executable not found [junit] java.io.IOException: javaws executable not found [junit] at com.sun.jna.WebStartTest.findJWS(WebStartTest.java:296) [junit] at com.sun.jna.WebStartTest.runTestUnderWebStart(WebStartTest.java:151) [junit] at com.sun.jna.WebStartTest.runTestUnderWebStart(WebStartTest.java:253) [junit] at com.sun.jna.WebStartTest.runBare(WebStartTest.java:370) Oddly, Building a debug version of JNA
<property name="debug.native" value="false"/> to <property name="debug.native" value="true"/>
STRIP=strip -x to STRIP=echo I also added DEBUG=true to the top. Build with: ant clean ant native ant jar cp build/jna.jar $PTII/lib Running with gdb under Mac OS Xcd $PTII gdb -java r -classpath .:/Users/cxh/ptII:/Users/cxh/ptII/lib/junit-4.8.2.jar:/Users/cxh/ptII/lib/jna.jar:/Users/cxh/ptII/lib/JUnitParams-0.4.0.jar:/Users/cxh/ptII/lib/ptjacl.jar:/Users/cxh/ptII/lib/jna.jar org.junit.runner.JUnitCore org.ptolemy.fmi.driver.test.junit.FMUJUnitTest Building JNA Under WindowsThese notes are about building JNA from source without the Variadic extensions
Building JNA Under CygwinWith a complete installation of Cygwin64 under Windows Server 2012R2, building JNA under Cygwin worked out of the box for me. See Windows Development Environment (from twall's github) for what Cygwin packages need to be installed. git clone https://github.com/twall/jna.git cd jna.git ant However, the tests hung, see Running JNA Tests under Windows Building JNA Under Microsoft Visual CSee Windows Development Environment (from twall's github) has a partial description of what is necessary, below are the changes that I had to make to build JNA from the git head on 2/24/2015: Building using Open VS2012 x64 Native Tools CommandIf you are not heavily using Cygwin, then try using the MSVC tools without Cygwin. In Cygwin Bash, check out the tree: git clone https://github.com/twall/jna.git Start up "Open VS2012 x64 Native Tools Command" and run cd jna.git ant Open VS2012 x64 Native Tools Command problem: The build is done with gcc, not clThe variables in Windows Development Environment (from twall's github) need to be set or else the build will occur with gcc. 24-Feb-2015: I stopped using Open VS2012 x64 here and focused on using Cygwin below Building under Cygwin Bash with MSVC tools: Set up environment variablesWindows Development Environment (from twall's github) says "Sample configuration, setting up INCLUDE/LIB:" and then lists what looks like bash commands for setting variables. export MSVC="/c/Program Files (x86)/Microsoft Visual Studio 10.0/vc" export WSDK="/c/Program Files (x86)/Microsoft SDKs/Windows/v7.0A" export WSDK_64="/c/Program Files/Microsoft SDKs/Windows/v7.1" export INCLUDE="$(cygpath -m "$MSVC")/include;$(cygpath -m "$WSDK")/include" # for 64-bit target export LIB="$(cygpath -m "$MSVC")/lib/amd64;$(cygpath -m "$WSDK_64")/lib/x64" # for 32-bit target export LIB="$(cygpath -m "$MSVC")/lib;$(cygpath -m "$WSDK")/lib"
Various issues are discussed below invalid syntax in conditionalWhile running [exec] Makefile:165: *** invalid syntax in conditional. Stop Line 165 of native/Makefile is the ifdef $(MSVC) USE_MSVC=true endif I had ifneq ($(MSVC), "") USE_MSVC=true endif I think the issue here is that MSVC is set to a value that has spaces in it? Cygwin with MSVC: configure: error: C compiler cannot create executablesWhen building the from the variadic extensions git repo under Cygwin with MSVC: [exec] checking for x86_64-w64-mingw32-gcc... /cygdrive/c/Users/cxh/src/jna/jna-cxbrooks/native/libffi/../cc.sh -m64 [exec] configure: error: in `/cygdrive/c/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/libffi':checking whether the C compiler works... no [exec] [exec] configure: error: C compiler cannot create executables [exec] See `config.log' for more details [exec] Makefile:418: recipe for target '../build/native-win32-x86-64/libffi/.libs/libffi.lib' failed [exec] make: *** [../build/native-win32-x86-64/libffi/.libs/libffi.lib] Error 77 Looking at configure:3673: /cygdrive/c/Users/cxh/src/jna/jna-cxbrooks/native/libffi/../cc.sh -m64 -std=gnu99 -DHAVE_PROTECTION -DPSAPI_VERSION=1 -DFFI_BUILDING -DUNICODE -D_UNICODE conftest.c >&5 Unsupported argument '-std=gnu99 The solution is to edit FFI_ENV=CC="$(CC)" CFLAGS="$(COPT) $(CDEBUG) -std=gnu99" CPPFLAGS="$(CDEFINES)" to: FFI_ENV=CC="$(CC)" CFLAGS="$(COPT) $(CDEBUG)" CPPFLAGS="$(CDEFINES)" and rerun Note that the above issue does 'not occur in the jna head as of February, 2015. This problem is probably in the 4.1 jna branch. Cygwin with MSVC: Unsupported argument '-std=gnu99'When building the from the variadic extensions git repo under Cygwin with MSVC: [exec] libtool: link: ( cd ".libs" && rm -f "libffi.la" && ln -s "../libffi.la" "libffi.la" ) [exec] make[3]: Leaving directory '/cygdrive/c/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/libffi' [exec] make[2]: Leaving directory '/cygdrive/c/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/libffi' [exec] make[1]: Leaving directory '/cygdrive/c/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/libffi' [exec] /cygdrive/c/Users/cxh/src/jna/jna-cxbrooks/native/libffi/../cc.sh -m64 -W -std=gnu99 -Wall -Wno-unused -Wno-parentheses -DHAVE_PROTECTION -DPSAPI_VERSION=1 -DFFI_BUILDING -DUNICODE -D_UNICODE -I"C:\Program Files\Java\jdk1.8.0_31\jre/../include" -I"C:\Program Files\Java\jdk1.8.0_31\jre/../include/win32" -I"C:\Users\cxh\src\jna\jna-cxbrooks\build\native-win32-x86-64" -I../build/native-win32-x86-64/libffi/include -DJNA_JNI_VERSION='"4.0.0"' -DCHECKSUM='"3f99b7ecf15cd6a6fc62cc9420598381"' -c dispatch.c -o ../build/native-win32-x86-64/dispatch.o [exec] Unsupported argument '-std=gnu99' [exec] Makefile:370: recipe for target '../build/native-win32-x86-64/dispatch.o' failed [exec] make: *** [../build/native-win32-x86-64/dispatch.o] Error 1 The solution is to edit PCFLAGS=-W -std=gnu99 -Wall -Wno-unused -Wno-parentheses to: PCFLAGS=-W -Wall -Wno-unused -Wno-parentheses Note that the above issue does 'not occur in the jna head as of February, 2015. This problem is probably in the 4.1 jna branch. Cygwin with MSVC: unresolved external symbol ffi_closure_va_sint8When building the from the variadic extensions git repo under Cygwin with MSVC: [exec] link is /cygdrive/c/Program Files (x86)/Microsoft Visual Studio 11.0/VC/BIN/amd64/link [exec] C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/LIB/amd64;C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/ATLMFC/LIB/amd64;C:/Program Files (x86)/Windows Kits/8.0/lib/win8/um/x64; [exec] "link" /nologo /opt:REF /incremental:no /subsystem:console /nodefaultlib:msvcrtd /out:"C:/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/jnidispatch.dll" /pdb:C:/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/jnidispatch.pdb /implib:C:/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/jnidispatch.lib /DLL C:/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/dispatch.o C:/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/callback.o C:/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/rsrc.o C:/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/dll-callback.o C:/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/libffi/.libs/libffi.lib psapi.lib (LIB=C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/LIB/amd64;C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/ATLMFC/LIB/amd64;C:/Program Files (x86)/Windows Kits/8.0/lib/win8/um/x64;) [exec] Creating library C:/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/jnidispatch.lib and object C:/Users/cxh/src/jna/jna-cxbrooks/build/native-win32-x86-64/jnidispatch.exp [exec] dispatch.o : error LNK2019: unresolved external symbol ffi_closure_va_sint8 referenced in function Java_com_sun_jna_Native_ffi_1closure_1va_1sint8 [exec] dispatch.o : error LNK2019: unresolved external symbol ffi_closure_va_sint16 referenced in function Java_com_sun_jna_Native_ffi_1closure_1va_1sint16 [exec] dispatch.o : error LNK2019: unresolved external symbol ffi_closure_va_sint32 referenced in function Java_com_sun_jna_Native_ffi_1closure_1va_1sint32 [exec] dispatch.o : error LNK2019: unresolved external symbol ffi_closure_va_sint64 referenced in function Java_com_sun_jna_Native_ffi_1closure_1va_1sint64 [exec] dispatch.o : error LNK2019: unresolved external symbol ffi_closure_va_uint8 referenced in function Java_com_sun_jna_Native_ffi_1closure_1va_1uint8 Note that the above issue does 'not occur in the jna head as of February, 2015. This problem is probably with the variadic patch. Analysis: The missing symbols are defined in #if FFI_CLOSURES # if __STDC_VERSION__ >= 199901L /* Note: int8_t, uint8_t, int16_t and uint16_t are promoted to int in '...' */ int8_t ffi_closure_va_sint8(ffi_cif *cif) { return ffi_closure_va_sint32(cif); } The issue here is that _STDC_VERSION is probably not defined for MSVC, so we change: # if __STDC_VERSION__ >= 199901L To: # if __STDC_VERSION__ >= 199901L || defined(_MSC_VER) This causes: [exec] cl /nologo /EHac /W3 /wd4127 /wd4820 /wd4706 /wd4100 /wd4255 /wd4668 -DHAVE_CONFIG_H /I"." /I"C:/Users/cxh/src/jna/jna-cxbrooks/native/libffi" /I"." /I"C:/Users/cxh/src/jna/jna-cxbrooks/native/libffi/include" /I"include" /I"C:/Users/cxh/src/jna/jna-cxbrooks/native/libffi/src" -DHAVE_PROTECTION -DPSAPI_VERSION='1' -DFFI_BUILDING -DUNICODE -D_UNICODE /c "C:/Users/cxh/src/jna/jna-cxbrooks/native/libffi/src/closures_va.c" /Fosrc/closures_va.obj "/Fdsrc/closures_va" "/Fpsrc/closures_va" "/Fasrc/closures_va" [exec] closures_va.c [exec] C:/Users/cxh/src/jna/jna-cxbrooks/native/libffi/src/closures_va.c(36) : error C2061: syntax error : identifier 'ffi_closure_va_sint8' [exec] C:/Users/cxh/src/jna/jna-cxbrooks/native/libffi/src/closures_va.c(36) : error C2059: syntax error : ';' [exec] C:/Users/cxh/src/jna/jna-cxbrooks/native/libffi/src/closures_va.c(36) : error C2059: syntax error : 'type' [exec] C:/Users/cxh/src/jna/jna-cxbrooks/native/libffi/src/closures_va.c(41) : error C2061: syntax error : identifier 'ffi_closure_va_uint8' [exec] C:/Users/cxh/src/jna/jna-cxbrooks/native/libffi/src/closures_va.c(41) : error C2059: syntax error : ';' [exec] C:/Users/cxh/src/jna/jna-cxbrooks/native/libffi/src/closures_va.c(41) : error C2059: syntax error : 'type' [exec] C:/Users/cxh/src/jna/jna-cxbrooks/native/libffi/src/closures_va.c(46) : error C2061: syntax error : identifier 'ffi_closure_va_sint16' Cannot open ../build/native-win32-x86-64/testlib.dllThe problem here was that the .dll already existed. The solution was to run Running After this, build succeeded, though the tests failed, see Running JNA Tests under Windows Running JNA Tests under WindowsRunning the JNA Tests using Eclipse under WindowsRunning the tests using Eclipse under Windows worked better.
testBatchCheckStructuredGetFieldOrderFails with java.lang.NoClassDefFoundError: com/google/common/base/Predicate Solution: Add testLoadFromUnicodePath errors from within Eclipse under WindowsWhen running all the tests with the JNA head from 24-Feb-2015, JNALoadTest.testLoadFromUnicodePath() fails: java.lang.Error: JVM error: System.load() failed to load JNA native library from C:\Users\cxh\AppData\Local\Temp\3\testLoadFromUnicodePath-флсву\jna7408683420722595513.dll): java.lang.UnsatisfiedLinkError: C:\Users\cxh\AppData\Local\Temp\3\testLoadFromUnicodePath-?????\jna7408683420722595513.dll: Can't find dependent libraries at com.sun.jna.JNALoadTest.testLoadFromUnicodePath(JNALoadTest.java:229) I'm not sure about the above, I'll skip it for now. DirectTest testGetOptionsFOrDirectMappingWithMemberInitializer() failsIn the JNA head from 24-Feb-2015, this test fails from within Eclipse, under Windows: junit.framework.AssertionFailedError: Wrong type mapper for direct mapping class com.sun.jna.DirectTest$DirectMapping$DirectStructure expected:<com.sun.jna.DefaultTypeMapper@5f8edcc5> but was:<null> at junit.framework.Assert.fail(Assert.java:57) at junit.framework.Assert.failNotEquals(Assert.java:329) at junit.framework.Assert.assertEquals(Assert.java:78) at junit.framework.TestCase.assertEquals(TestCase.java:244) at com.sun.jna.DirectTest.testGetOptionsForDirectMappingWithMemberInitializer(DirectTest.java:212) DirectTest.testGetOptionsForDirectMappingWithStaticInitializer fails from within Eclipse under Windowsjunit.framework.AssertionFailedError: Wrong type mapper for direct mapping class com.sun.jna.DirectTest$DirectMappingStatic$DirectStructure expected:<com.sun.jna.DefaultTypeMapper@1ebd319f> but was:<null> at junit.framework.Assert.fail(Assert.java:57) at junit.framework.Assert.failNotEquals(Assert.java:329) at junit.framework.Assert.assertEquals(Assert.java:78) at junit.framework.TestCase.assertEquals(TestCase.java:244) at com.sun.jna.DirectTest.testGetOptionsForDirectMappingWithStaticInitializer(DirectTest.java:255) Native library not foundWhile testing the varargs extensions, win32-x86-64/testlib-path.dll was not found java.io.IOException: Native library (win32-x86-64/testlib-path.dll) not found in resource path ([file:/c:/Users/cxh/src/jna/jna.git/build/native-win32-x86-64]) at com.sun.jna.Native.extractFromResourcePath(Native.java:840) at com.sun.jna.LibraryLoadTest.testExtractFromResourcePath(LibraryLoadTest.java:64) The solution is to run Also, it turns out that the error was that I had the wrong Running JNA Tests using Cygwin under WindowsIn the devel tree (no variadic extensions), the JNA Callback tests hang when I build from Cygwin using either gcc or MSVC. However, if I build from the Open VS2012 x64 Native Tools Command Prompt, then they don't hang. 24-Feb-2015: I could not replicate the previous statement, I was not able to build from the Open VS2012 x64 Native Tools Command Prompt. Building using Cygwin with MSVC and then running the tests from that tool also hung.
To replicate outside of ant, I ran export IGNORE='C:\Users\cxh\src\jna' C:/Program\ Files/Java/jdk1.8.0_25/bin/java.exe \ -Ddummy \ -Djna.library.path=C:/Users/cxh/src/jna/build/native-win32-x86-64 \ -Djna.nosys=true \ -Djna.protected=true \ -Djna.builddir=C:/Users/cxh/src/jna/build \ -Djna.nativedir=C:/Users/cxh/src/jna/build/native-win32-x86-64 \ -classpath \ 'C:\Users\cxh\src\jna\build\jna.jar;C:\Users\cxh\src\jna\build\test-classes;C:\Users\cxh\src\\ jna\build\jna-test.jar;C:\Users\cxh\src\jna\lib\clover.jar;C:\Users\cxh\src\jna\lib\junit.jar\ ;C:\Users\cxh\src\jna\lib\test\dom4j-1.6.1.jar;C:\Users\cxh\src\jna\lib\test\guava-11.0.2.jar\ ;C:\Users\cxh\src\jna\lib\test\javassist-3.12.1.GA.jar;C:\Users\cxh\src\jna\lib\test\reflecti\ ons-0.9.8.jar;C:\Users\cxh\src\jna\lib\test\slf4j-api-1.6.1.jar;C:\Users\cxh\src\jna\build\cl\ asses;C:\cygwin64\usr\local\apache-ant-1.9.4\lib\ant-launcher.jar;C:\cygwin64\usr\local\apach\ e-ant-1.9.4\lib\ant.jar;C:\cygwin64\usr\local\apache-ant-1.9.4\lib\ant-junit.jar;C:\cygwin64\\ usr\local\apache-ant-1.9.4\lib\ant-junit4.jar' \ com.sun.jna.CallbacksTest \ skipNonTests=false \ filtertrace=true \ haltOnError=false \ haltOnFailure=false \ showoutput=false \ outputtoformatters=true \ logfailedtests=true \ threadid=0 \ logtestlistenerevents=false \ formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter \ formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,C:\Users\cxh\s\ rc\jna\build\junit-results\TEST-com.sun.jna.CallbacksTest.xml \ crashfile=C:/Users/cxh/src/jna/build/junitvmwatcher727685508021720459.properties \ propsfile=C:/Users/cxh/src/jna/build/junit4057250054536740714.properties jvisualvm does not show the process? JNA Tests under Windows Server 2008R2On Joule, which is running Windows Server 2008R2, the variadic tests failed in the jna devel tree on 2014-12-14. [junit] Testcase: testDLLCallback(com.sun.jna.CallbacksTest): Caused an ERROR [junit] No more DLL callback slots available [junit] at com.sun.jna.Native.createNativeCallback(Native Method) [junit] at com.sun.jna.CallbackReference.<init>(CallbackReference.java:232) [junit] at com.sun.jna.CallbackReference.getFunctionPointer(CallbackReference.java:398) [junit] at com.sun.jna.CallbackReference.getFunctionPointer(CallbackReference.java:380) [junit] at com.sun.jna.Function.convertArgument(Function.java:534) [junit] at com.sun.jna.Function.invoke(Function.java:297) [junit] at com.sun.jna.Library$Handler.invoke(Library.java:212) [junit] at com.sun.proxy.$Proxy0.callVoidCallback(Unknown Source) [junit] at com.sun.jna.CallbacksTest.testDLLCallback(CallbacksTest.java:1257)
[junit] Testsuite: com.sun.jna.JNALoadTest [junit] Tests run: 5, Failures: 0, Errors: 1, Time elapsed: 4.852 sec [junit] [junit] Testcase: testLoadFromUnicodePath(com.sun.jna.JNALoadTest): Caused an ERROR [junit] JVM error: System.load() failed to load JNA native library from C:\Users\cxh.EECS\testLoadFromUnicodePath-?????\jna1665291666603896836.dll): java.lang.UnsatisfiedLinkError: C:\Users\cxh.EECS\testLoadFromUnicodePath-?????\jna1665291666603896836.dll: Can't find dependent libraries [junit] java.lang.Error: JVM error: System.load() failed to load JNA native library from C:\Users\cxh.EECS\testLoadFromUnicodePath-?????\jna1665291666603896836.dll): java.lang.UnsatisfiedLinkError: C:\Users\cxh.EECS\testLoadFromUnicodePath-?????\jna1665291666603896836.dll: Can't find dependent libraries [junit] at com.sun.jna.JNALoadTest.testLoadFromUnicodePath(JNALoadTest.java:229)
[junit] Testcase: testLoadJAWT(com.sun.jna.LibraryLoadTest): Caused an ERROR [junit] The specified module could not be found. [junit] [junit] java.lang.UnsatisfiedLinkError: The specified module could not be found. [junit] [junit] at com.sun.jna.Native.getWindowHandle0(Native Method) [junit] at com.sun.jna.Native$AWT.getComponentID(Native.java:2010) [junit] at com.sun.jna.Native$AWT.getWindowID(Native.java:1986) [junit] at com.sun.jna.Native.getWindowPointer(Native.java:275) [junit] at com.sun.jna.LibraryLoadTest$AWT.loadJAWT(LibraryLoadTest.java:286) [junit] at com.sun.jna.LibraryLoadTest.testLoadJAWT(LibraryLoadTest.java:49) The above is expected because I'm connected via ssh with no X11 setup. This should be verified by running on the machine. [junit] Testsuite: com.sun.jna.WebStartTest [junit] Tests run: 6, Failures: 0, Errors: 6, Time elapsed: 181.583 sec [junit] [junit] Testcase: testDetectError(com.sun.jna.WebStartTest): Caused an ERROR [junit] JWS Timed out [junit] java.lang.Error: JWS Timed out [junit] at com.sun.jna.WebStartTest.runTestUnderWebStart(WebStartTest.java:199) [junit] at com.sun.jna.WebStartTest.runTestUnderWebStart(WebStartTest.java:240) [junit] at com.sun.jna.WebStartTest.runBare(WebStartTest.java:373) The above can probably be ignored. BTW - Java 1.8 or so now requires setup for the Java Web Start local files to work. Under Windows, start up the Java Control Panel and add Notes about building JNA-4.0 under WindowsTo get build JNA-4.0 from sources under Windows Server 2012R2 64-bit, I installed Visual Studio. In the Windows Environment Variables control panel, I set
JNA NotesRandom notes and trains of thoughts... JNA Struct By Referencehttp://www.eshayne.com/jnaex/example03.html C: typedef struct Example3Struct { int val; } Example3Struct; ... void example3_sendStruct(const Example3Struct* sval) { // note: printfs called from C won't be flushed // to stdout until the Java process completes printf("(C) %d\n", sval->val); } Java: public interface CLibrary extends Library { public static class Example3Struct extends Structure { public static class ByReference extends Example3Struct implements Structure.ByReference {} public int val; } ... // unless otherwise specified, ByReference is assumed - but it can't hurt to be explicit public void example3_sendStruct(Example3Struct.ByReference sval); } ... CLibrary clib = (CLibrary)Native.loadLibrary("testlib", CLibrary.class); ... CLibrary.Example3Struct.ByReference e3ref = new CLibrary.Example3Struct.ByReference(); e3ref.val = 7; clib.example3_sendStruct(e3ref); JNA Invalid Memory accessWhen loading a 64-bit FMU created by Dymola, the following was observed: Caused by: java.lang.Error: Invalid memory access at com.sun.jna.Native.invokePointer(Native Method) at com.sun.jna.Function.invokePointer(Function.java:470) at com.sun.jna.Function.invoke(Function.java:404) at com.sun.jna.Function.invoke(Function.java:315) at com.sun.jna.Function.invoke(Function.java:268) at ptolemy.actor.lib.fmi.FMUImport.preinitialize(FMUImport.java:1861) Line 1861 is: _fmiComponent = (Pointer) _fmiInstantiateFunction.invoke( Pointer.class, new Object[] { getFullName(), fmiType, _fmiModelDescription.guid, _fmiModelDescription.fmuResourceLocation, _callbacks, toBeVisibleFMI2, loggingOnFMI2 }); The function being called is /* Creation and destruction of FMU instances and setting debug status */ typedef fmi2Component fmi2InstantiateTYPE (fmi2String, fmi2Type, fmi2String, fmi2String, const fmi2CallbackFunctions*, fmi2Boolean, fmi2Boolean); with these typedefs and structs: typedef void* fmi2Component; /* Pointer to FMU instance */ typedef void* fmi2ComponentEnvironment; /* Pointer to FMU environment */ typedef void* fmi2FMUstate; /* Pointer to internal FMU state */ typedef unsigned int fmi2ValueReference; typedef double fmi2Real ; typedef int fmi2Integer; typedef int fmi2Boolean; typedef char fmi2Char; typedef const fmi2Char* fmi2String; typedef char fmi2Byte; typedef enum { fmi2ModelExchange, fmi2CoSimulation } fmi2Type; typedef void (*fmi2CallbackLogger) (fmi2ComponentEnvironment, fmi2String, fmi2Status, fmi2String, fmi2String, ...); typedef void* (*fmi2CallbackAllocateMemory)(size_t, size_t); typedef void (*fmi2CallbackFreeMemory) (void*); typedef void (*fmi2StepFinished) (fmi2ComponentEnvironment, fmi2Status); typedef struct { const fmi2CallbackLogger logger; const fmi2CallbackAllocateMemory allocateMemory; const fmi2CallbackFreeMemory freeMemory; const fmi2StepFinished stepFinished; const fmi2ComponentEnvironment componentEnvironment; } fmi2CallbackFunctions; Interestingly, running without the variadic extensions fails with both jna-4.0.0.jar and jna-4.1.0.jar: java -classpath "c:\Users\cxh\ptII\lib\jna-4.0.0.jar;c:\Users\cxh\ptII" ptolemy.vergil.VergilApplication -ptiny *.xml Also, using the fmusdk fmus compiled with Microsoft Visual Studio also works: java -classpath "c:\Users\cxh\ptII\lib\jna-4.1.0-variadic.jar;c:\Users\cxh\ptII" org.ptolemy.fmi.driver.FMUCoSimulation c:/Users/cxh/src/fmi/fmusdk/fmu20/fmu/cs/x64/inc.fmu 11.0 1.0 true Disassembly of the Dymola fmi2Instantiate method.Running gdb on the fmusdk/bin/x64/fmu20sim_cs.exe (gdb) break fmi2Instantiate No symbol table is loaded. Use the "file" command. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 2 (fmi2Instantiate) pending. (gdb) r expDecayCurve.fmu Starting program: /cygdrive/c/Users/cxh/src/fmi/fmusdk/bin/x64/fmu20sim_cs.exe/expDecayCurve.fmu [New Thread 6568.0x1948] warning: Application "\??\C:\Windows\system32\cmd.exe" found in cache Breakpoint 2, 0x0000000180001447 in fmi2Instantiate () from /tmp/fmu/binaries/win64/expDecayCurve.dll (gdb) where #0 0x0000000180001447 in fmi2Instantiate () from /tmp/fmu/binaries/win64/expDecayCurve.dll #1 0x00007ff6650a1134 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) ... (gdb) disassemble fmi2Instantiate Dump of assembler code for function fmi2Instantiate: 0x0000000180001430 <+0>: mov %r9,0x20(%rsp) 0x0000000180001435 <+5>: mov %r8,0x18(%rsp) 0x000000018000143a <+10>: mov %edx,0x10(%rsp) 0x000000018000143e <+14>: mov %rcx,0x8(%rsp) 0x0000000180001443 <+19>: sub $0x58,%rsp 0x0000000180001447 <+23>: mov 0x90(%rsp),%eax 0x000000018000144e <+30>: mov %eax,0x30(%rsp) 0x0000000180001452 <+34>: mov 0x88(%rsp),%eax 0x0000000180001459 <+41>: mov %eax,0x28(%rsp) 0x000000018000145d <+45>: mov 0x80(%rsp),%rax 0x0000000180001465 <+53>: mov %rax,0x20(%rsp) 0x000000018000146a <+58>: mov 0x78(%rsp),%r9 0x000000018000146f <+63>: mov 0x70(%rsp),%r8 0x0000000180001474 <+68>: mov 0x68(%rsp),%edx 0x0000000180001478 <+72>: mov 0x60(%rsp),%rcx 0x000000018000147d <+77>: callq 0x18000b760 <setTimerCounterCB+30432> 0x0000000180001482 <+82>: mov %rax,0x40(%rsp) 0x0000000180001487 <+87>: mov 0x40(%rsp),%rax 0x000000018000148c <+92>: add $0x58,%rsp 0x0000000180001490 <+96>: retq 0x0000000180001491 <+97>: int3 0x0000000180001492 <+98>: int3 0x0000000180001493 <+99>: int3 0x0000000180001494 <+100>: int3 0x0000000180001495 <+101>: int3 0x0000000180001496 <+102>: int3 0x0000000180001497 <+103>: int3 0x0000000180001498 <+104>: int3 0x0000000180001499 <+105>: int3 0x000000018000149a <+106>: int3 0x000000018000149b <+107>: int3 0x000000018000149c <+108>: int3 0x000000018000149d <+109>: int3 0x000000018000149e <+110>: int3 0x000000018000149f <+111>: int3 End of assembler dump. (gdb) Running on a fmusdk 64-bit fmu compiled with MSVC: (gdb) r inc.fmu Starting program: /cygdrive/c/Users/cxh/src/fmi/fmusdk/bin/x64/fmu20sim_cs.exe inc.fmu [New Thread 4840.0x1b90] warning: Application "\??\C:\Windows\system32\cmd.exe" found in cache Breakpoint 1, 0x00007ffbbca112f7 in inc!fmi2Instantiate () from /tmp/fmu/binaries/win64/inc.dll (gdb) disassemble fmi2Instantiate Dump of assembler code for function inc!fmi2Instantiate: 0x00007ffbbca112e0 <+0>: mov %r9,0x20(%rsp) 0x00007ffbbca112e5 <+5>: mov %r8,0x18(%rsp) 0x00007ffbbca112ea <+10>: mov %edx,0x10(%rsp) 0x00007ffbbca112ee <+14>: mov %rcx,0x8(%rsp) 0x00007ffbbca112f3 <+19>: sub $0x68,%rsp => 0x00007ffbbca112f7 <+23>: mov 0x90(%rsp),%rax 0x00007ffbbca112ff <+31>: cmpq $0x0,(%rax) 0x00007ffbbca11303 <+35>: jne 0x7ffbbca1130c <inc!fmi2Instantiate+44> 0x00007ffbbca11305 <+37>: xor %eax,%eax 0x00007ffbbca11307 <+39>: jmpq 0x7ffbbca117b7 <inc!fmi2Instantiate+1239> 0x00007ffbbca1130c <+44>: mov 0x90(%rsp),%rax 0x00007ffbbca11314 <+52>: cmpq $0x0,0x8(%rax) 0x00007ffbbca11319 <+57>: je 0x7ffbbca1132a <inc!fmi2Instantiate+74> 0x00007ffbbca1131b <+59>: mov 0x90(%rsp),%rax 0x00007ffbbca11323 <+67>: cmpq $0x0,0x10(%rax) Interestingly, comparing the two versions, they are the same until the 5th line. Dymola fmu that fails: 0x0000000180001443 <+19>: sub $0x58,%rsp fmusdk fmu that works: 0x00007ffbbca112f3 <+19>: sub $0x68,%rsp Why are they different? Probably because inc's fmi2Instantiate has a local (ModelInstance *comp) on the stack. I'm not sure why they are 16 bytes different. Could be alignment. In the 64-bit inc.fmu, fmi2Instantiate is defined in fmuTemplate.c: // --------------------------------------------------------------------------- // FMI functions // --------------------------------------------------------------------------- fmi2Component fmi2Instantiate(fmi2String instanceName, fmi2Type fmuType, fmi2String fmuGUID, fmi2String fmuResourceLocation, const fmi2CallbackFunctions *functions, fmi2Boolean visible, fmi2Boolean loggingOn) { // ignoring arguments: fmuResourceLocation, visible ModelInstance *comp; if (!functions->logger) { return NULL; } Resources:
JNA Alignment
"getTypeMapper(java.lang.Class) and getStructureAlignment(java.lang.Class) are provided to avoid having to explicitly pass these parameters to Structures, which would require every Structure which requires custom mapping or alignment to define a constructor and pass parameters to the superclass. To avoid lots of boilerplate, the base Structure constructor figures out these properties based on its enclosing interface."
"Memory.align() does not allocate more memory, it just changes the base pointer and reduces the size of the allocated block."
fmiCallbackLoggerThe typedef void (*fmiCallbackLogger) (fmiComponent c, fmiString instanceName, fmiStatus status, fmiString category, fmiString message, ...); fmiPlatformTypes.h defines typedef void* fmiComponent; typedef unsigned int fmiValueReference; typedef double fmiReal ; typedef int fmiInteger; typedef char fmiBoolean; typedef const char* fmiString ;
FMILibrary.java: public interface FMICallbackLogger extends Callback { void apply(Pointer fmiComponent, Pointer instanceName, int status, Pointer category, Pointer message/*, String ... parameters*/); }; } FMUCoSimulation.java: public interface FMULibrary extends FMILibrary { public class FMULogger implements FMICallbackLogger { public void apply(Pointer c, Pointer instanceName, int status, Pointer category, Pointer message/*, String ... parameters*/) { System.out.println("Java FMULogger, status: " + status); System.out.println("Java FMULogger, message: " + message.getString(0)); } } However, when we run, we get various segfaults when the logger is invoked and we have the varargs arguments. It turns out that the segfault problem was because the code was not properly allocating memory and keeping handles to the allocated memory. Thus, the allocated memory was being gc'd. The code in question has callbacks for allocating and freeing memory. The fix is to keep a list of allocated memory and have the allocate callback add a reference to the Java list and have the free callback remove the reference. The code below more accurately represents the C code. FMILibrary.java: public interface FMICallbackLogger extends Callback { void apply(Pointer fmiComponent, String instanceName, int status, String category, String message/*, String ... parameters*/); }; } FMUCoSimulation.java: public interface FMULibrary extends FMILibrary { public class FMULogger implements FMICallbackLogger { public void apply(Pointer c, String instanceName, int status, String category, String message/*, String ... parameters*.) { System.out.println("Java FMULogger, status: " + status); System.out.println("Java FMULogger, message: " + message); } }
After modifying Exception in thread "main" java.lang.IllegalArgumentException: Structure field "logger" was declared as interface org.ptolemy.fmi.FMILibrary$FMICallbackLogger, which is not supported within a Structure at com.sun.jna.Structure.writeField(Structure.java:717) at com.sun.jna.Structure.write(Structure.java:635) at com.sun.jna.Structure.autoWrite(Structure.java:1603) at com.sun.jna.Function.convertArgument(Function.java:467) at com.sun.jna.Function.invoke(Function.java:258) at com.sun.jna.Function.invoke(Function.java:235) at org.ptolemy.fmi.FMUCoSimulation.simulate(FMUCoSimulation.java:224) at org.ptolemy.fmi.FMUCoSimulation.main(FMUCoSimulation.java:170) Caused by: java.lang.IllegalArgumentException: Callback argument class [Ljava.lang.Object; requires custom type conversion at com.sun.jna.CallbackReference.<init>(CallbackReference.java:203) at com.sun.jna.CallbackReference.getFunctionPointer(CallbackReference.java:375) at com.sun.jna.CallbackReference.getFunctionPointer(CallbackReference.java:357) at com.sun.jna.Pointer.setValue(Pointer.java:894) at com.sun.jna.Structure.writeField(Structure.java:709) ... 7 more Timothy Wall commented:
JNA Custom Type ConversionSearch for "requires custom type conversion" brings up:
This is incomplete I was able to create a custom type conversion called public TypeMapper TYPE_MAPPER = FMITypeMapper.FMITYPEMAPPER; |