Use C lib (dll) in java with specific c call convention cdecl -


i working on project have sensors , want them connect pc via usb. write there windows lib written in c , functions using cdecl call convention of c , have sure if programm in other language (java!) call convention given.

so researched bit , found few tutorials bind dlls in java , or use jna. new things me , want sure, possible (and maybe example) - device isn't cheap , want know before buy it.

you can call c code java - there no issues here.

then, if have specific in c routines, can go via wrapper.

take here.

http://jnicookbook.owsiak.org/recipe-no-018/

in sample, calling c code - in turn - calls library.

you can linking jni code other library. here:

https://github.com/mkowsiak/jnicookbook/tree/master/recipeno023

there plenty of options. when comes jni vs. jna. make sure jna efficient enough. in general, jna tends slower. take here:

https://github.com/mkopsnc/keplerhacks/tree/master/jnijna

hope helps.

i don't post codes here - samples in jni cookbook available github.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -