JNA 调用fortran编写的Dll 问题 5C

本地环境:win7(32位) + jdk1.8(32位) + jna-4.2.1.jar;
代码:

IJnaTest.java :

    IJnaTest instanceDll=(IJnaTest) Native.loadLibrary("Dll1", IJnaTest.class);

    void MAIN1_mp_XAJMAIN(String Address,FloatByReference AA,IntByReference Cla);

Test.java:

public static void main(String[] args) {
    String Address="D://";
    FloatByReference AA=new FloatByReference(12.2f);
    IntByReference Cla=new IntByReference(1);

    IJnaTest it=IJnaTest.instanceDll;
    it.MAIN1_mp_XAJMAIN(Address, AA, Cla);

} 
报错信息如下:
    Exception in thread "main" java.lang.Error: Invalid memory access
    at com.sun.jna.Native.invokeVoid(Native Method)
    at com.sun.jna.Function.invoke(Function.java:374)
    at com.sun.jna.Function.invoke(Function.java:323)
    at com.sun.jna.Library$Handler.invoke(Library.java:236)
    at com.sun.proxy.$Proxy0.MAIN1_mp_XAJMAIN(Unknown Source)
    at com.jna.Test.main(Test.java:40)

求大神搭救!!






1个回答

指针的问题,比如指针出错,或者你给的是只读的内存,函数内试图写入,或者越界

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!