Fail to call OpenDevice() with Eclipse (K8055D.dll)

Dear all,

I am a new programmer for K8055D. I want to build a interface between the .dll and my main code. However, I have tried to use JNI (eclipse) to open the device and I fail. I don’t know why. Here is the code:

import java.util.*;
public class driver {
	
	public native long OpenDevice(long i);

	static {
		System.loadLibrary("K8055D");
		
	}

	public static void main(String[] args) {
		try{
				driver newdriver=new driver();
				newdriver.OpenDevice(0);
		}catch(Exception e){
			System.out.println("No!");
		}
	}

}

I think I did everything correct. But, there is a error message:
Exception in thread “main” java.lang.UnsatisfiedLinkError: driver.OpenDevice(J)J

I have been looking around for solution for a while. I really appreciate your help!

Best,
Johnny

You copied the example code but you forgot to read the rest :slight_smile: All examples create their own DLL in C++ with functions that are exported in a special way so they can be used in JAVA. The K8055 DLL was not compiled like that, so you will need to create a DLL (the way JAVA likes it) that calls the K8055 DLL.

support.microsoft.com/kb/222092