Java call function from a dll

前端 未结 1 1956
无人共我
无人共我 2021-01-29 05:25

I have this python script that imports a zkemkeeper dll and connects to a time attendance device(ZKTeco). Here is is a script I\'m using:



        
相关标签:
1条回答
  • 2021-01-29 05:36

    The two choices for calling native code from Java are JNI (Java Native Interface) and JNA (Java Native Access)

    The Java runtime can do JNI out of the box, but you need to create a wrapper library with functions specifically made for JNI (just putting in a native keyword is not enough).

    JNA is a 3rd party library that uses libffi to make native code accessible from Java.

    You have to see for yourself which approach better suits your needs.

    Edit: looking at your example code again, is that a COM call? While COM can be done with JNA (doing that myself), it's quite complicated. Your best bet is probably a wrapper C library that does the actual calls or a Java/COM bridge product like JACOB (have never used it, however).

    0 讨论(0)
提交回复
热议问题