V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
XiLemon
V2EX  ›  程序员

JNA DLL 中方法调用的问题

  •  
  •   XiLemon · Jun 24, 2018 · 2429 views
    This topic created in 2867 days ago, the information mentioned may be changed or developed.

    只会一点基础的 C 语言,现在要通过 JNA 调用 DLL 中的函数,其他函数调用的都没问题,就下面图中的第一个函数调用报错如下:

    Caused by: java.lang.UnsatisfiedLinkError: Error looking up function 'st_wsx_TvWallCallMode': 找不到指定的程序。
    

    接口是这么写的:

    public interface StWsxLibDll extends StdCallLibrary {
    	
        StWsxLibDll instance = Native.loadLibrary("StWsxLib", StWsxLibDll.class);
        int st_wsx_TvWallCallMode(String pDecPuid, String pDecServerIp, int nDecServerPort, int nModelID);
        
    }
    

    我大致了解了一下 Snipaste_2018-06-24_11-14-48.png

    我估计是我接口写的不对,但是这个接口该怎么写,希望 V 站大佬指点一下!!!

    4 replies    2018-06-26 09:08:24 +08:00
    XiLemon
        2
    XiLemon  
    OP
       Jun 25, 2018
    @ysc3839 试了一下,能把方法调出来,估计参数传递有问题,一直返回 0,调用失败:-(,很好奇这个 char* 的参数到底该怎么传,传 String 直接 Invalid memory access,传字节数组又一直返回 0
    ysc3839
        3
    ysc3839  
       Jun 25, 2018 via Android
    @XiLemon 发 DLL 文档来看看。
    XiLemon
        4
    XiLemon  
    OP
       Jun 26, 2018
    @ysc3839 发到邮箱了 :-)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5098 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 08:21 · PVG 16:21 · LAX 01:21 · JFK 04:21
    ♥ Do have faith in what you're doing.