The problem of using JNA to call .so file under centos7

public class CalProcess
{

public interface CLibrary extends Library {
    CLibrary INSTANCE = (CLibrary)
        Native.loadLibrary((Platform.isWindows() ? "CalProcess" : "cal_process"),
                           CLibrary.class);
    byte Cal_data(short key,byte data);
}

public static void main(String[] args)
{
    int i = CLibrary.INSTANCE.Cal_data((short)5,(byte)2);
    System.out.println(i);
}

}

above is the JNA part of the code;

The header file of

.so is as follows:

-sharpifndef __CAL_PROCESS_INCLUDED__
-sharpdefine __CAL_PROCESS_INCLUDED__
-sharpinclude <stdint.h>
uint8_t Cal_data(uint16_t key,uint8_t data);

-sharpendif // __CAL_PROCESS_INCLUDED__

runs in centos7, and the result is
Could not initialize class com.xxx.xxx.socket.dll.CalProcess$CLibrary

.

means you can"t understand what"s wrong with it. Call for help.

Mar.17,2021
Menu