JNA calls c++ class method

For java to call dll, JNA is a super upgraded version of JNI, which means that the heavy template can be thrown away, and the dll can basically be called directly

The use of JNA on the Internet mostly focuses on calling direct methods and simulating structures. There are a lot of information, so I won’t go into details here. I recommend a JNA introductory tutorial blog: https://blog.csdn.net/gwd1154978352/article/ details/55097376/

Regarding how JNA calls the c++ class method, I searched for a long time and couldn't find any information. Finally, I found a calling example on github, which is of great reference value: https://github.com/remram44/java-cpp-example

To put it simply, JNA has no way to directly call the class method, and needs to "take out" the class method and re-encapsulate it again. At the same time, in order to maintain the characteristics of the class, each method adds a parameter to pass the reference of the class object.

Supongo que te gusta

Origin blog.csdn.net/qq_34507736/article/details/83030005
Recomendado
Clasificación