1、自己搞一个dll出来。参考下面链接

http://blog.csdn.net/lqena/article/details/46357165。

2、下载jar jna-4.2.1.jar。

3、复制dll到项目根目录、或者 system32下面。

4、调用代码如下。

public interface CLibrary extends Library {
        CLibrary INSTANCE = (CLibrary) Native.loadLibrary("MyDLL", CLibrary.class);

        public int GetInt(); 
        
        public String GetStr(String a);
    }
public static void main(String[] args) throws Exception {
        // TODO Auto-generated method stub
        // test();
        System.out.println(CLibrary.INSTANCE.GetInt());
        System.out.println(CLibrary.INSTANCE.GetStr("ss"));
    }

 

相关文章:

  • 2021-07-31
  • 2021-08-25
  • 2021-10-30
  • 2022-12-23
  • 2021-12-19
  • 2021-12-11
  • 2021-06-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
相关资源
相似解决方案