动态库开发环境:VC6.0
动态库:Win32 Dynamic-Link Library
JAVA开发环境:MyEclipse 6.5
JNA
动态库名称:TestDll.dll
动态库接口定义:
int WINAPI fpTestFun1();
int WINAPI fpTestFun2(HANDLE hHandle);
JAVA:
import com.sun.jna.*;
import com.sun.jna.win32.*;
public class TestDllTest
{
public static void main(String[] args)
{
int nHandle = TestDllI.INSTANCE.fpTestFun1();
int nResult = TestDllI.INSTANCE.fpTestFun2(nHandle);
.........
}
public interface TestDll extends Library
{
TestDll INSTANCE = (TestDll)Native.loadLibrary("TestDll", TestDll.class);
int fpTestFun1();
int fpTestFun2(int nHandle);
}