com.sun.jna.Library interface in Java, and call this interface. For example:public interface MyCLibrary extends Library { public void myFunction(int value); }Here if means that there is a function in the C dll called
myFunction[1]
declspec(dllexport) declaration is there to make the declaration available outside of the dlldeclspec(dllexport) void myFunction(int value);
| C type | Java type | Comment | Example |
|---|---|---|---|
| bool | boolean | - | C code: void receive(bool boolValue)Java code: public void receive(boolean boolValue); |
| char | byte | - | C code: void receive(char cValue)Java code: public void receive(byte cValue); |
| int | int | - | C code: void receive(int iValue)Java code: public void receive(int iValue); |
| float | float | - | C code: void receive(float fValue)Java code: public void receive(float fValue); |
| double | double | - | C code: void receive(double dValue)Java code: public void receive(double dValue); |
| long | NativeLong | This is the com.sun.jna.NativeLong JNA class |
C code: void receive(long lValue)Java code: public void receive(NativeLong lValue); |
| size_t | long | _ | C code: void receive(size_t lValue)Java code: public void receive(long lValue); |
| char* | String | - | C code: void receive(char* sValue)Java code: public void receive(String sValue); |
| C type | Java type | Comment | |
|---|---|---|---|
| bool[] | Pointer | - | C code: void receive(boolean bArray[])Java code: public void receive(Pointer bArray); |
| int[dimension] | int[] | - | |
| int[] | Pointer | - | C code: void receive(int iArray[])Java code: public void receive(Pointer iArray); |
| float[] | Pointer | - | C code: void receive(float fArray[])Java code: public void receive(Pointer fArray); |
| double[] | Pointer | - | C code: void receive(double dArray[])Java code: public void receive(Pointer dArray); |
| *char[] | Pointer[] | - |
declspec(dllexport) declaration is there to make the declaration available outside of the dllCopyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence