You can get the source code 
[here](https://gist.github.com/jangko/48ba0b76716d0631560e5f2ff470256d). There 
are 5 files.

how to build sample code:
    
    
    javac Sample1.java
    
    javah -classpath . Sample1
    
    nim c --app:lib --passL:"-static-libgcc" --passL:"-Wl,--kill-at" Sample1
    

You can omit -static-libgcc part, but you must use "-Wl,--kill-at" to remove 
'@' from exported symbol name.

don't forget to include jni_export in all your project files that uses 
jni.nim(don't import it, use include)

and finally, run the java vm:
    
    
    java Sample1
    

beware: if there exist more than one dll plugin written in Nim, please use 
compiler switch "-d:useNimRtl", (I never tested it before, but the 
documentation says like that) 

Reply via email to