当前位置:网站首页>[mixed programming JNI] Part 12 jnaerator

[mixed programming JNI] Part 12 jnaerator

2022-06-26 22:07:00 Hua Weiyun

If a worker wants to do a good job, he must sharpen his tools first , We can write simple functions manually , But it's a little too much for me to write complex structures by myself

, This mode of production is a little low , And it may be wrong , After all, machines are more reliable than people

This section introduces JNA Tools for jnaerator, Free you from cumbersome and complex signatures

jnaerator Origin

Project address :GitHub - java-native-access/jna: Java Native Access

JNA send Java Programs can easily access native shared libraries , No need to write Java Anything other than code - Unwanted JNI Or native code .

Java The call looks like a call in native code . Most calls do not require special handling or configuration ; No template files or generated code are required .

Used by developers Java Interface to describe the functions and structures in the target local library . This makes it very easy to take advantage of native platform features

JNA jar Package download address : jna -5.10.0.jar jna-jpms-5.10.0.jar

This is a JNA Core artifacts for , Contains only binding libraries and core helper classes .

JNA platform

jna -platform-5.10.0.jar jna-platform-jpms-5.10.0.jar

This artifact contains cross platform mapping and mapping of many common platform functions , Including a large number of Win32 Mapping and a set of utility classes that simplify native access . The code has been tested , The utility interface ensures proper handling of native memory management .

Generate interface file

Script

java -jar jna-5.10.0.jar \    -runtime JNA \    -mode Directory \    -o jna_code    -package com.pdool    -f ./library.h ./SSC.h  libtestCppJNA.so

Command documentation :Command Line Options And Environment Variables · nativelibs4java/JNAerator Wiki · GitHub

Too many will not be copied

summary :

This section is basically nothing special , Mainly to talk about this tool

The official website for the specific use of tools , Just watch and try to thank yourself , Nothing



原网站

版权声明
本文为[Hua Weiyun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206262200389370.html