0
votes

I wrote a JNI wrapper for .net DLL file (DLL has been updated accordingly) but the solution stucks as soon as the call to dll function is made.

I have a .net dll which is used to access SecuGen Fingerprint scanner. It is working fine when used in a .net project. Now I want to use it in a JAVA project. I have updated the dll file according to the JNI requirements. It is not returning once the function in a dll has bee called that is the control leaves JVM and hence i cant debug what is wrong or happening. Edit: I have finally been able to call one of function from dll (a simpler one). But still when i call the CaptureImage it just hangs.

1
Attach a .NET or native debugger and find out?Botje
Possible duplicate of Calling a 3rd party .NET DLL using JNIyms
I tried debugging the code itself and dump the threads. It seems the threads are waiting for response from the dll file.Awais Waheed
@yms no result is being returned from dll. I'm not getting any exception.Awais Waheed

1 Answers

0
votes

What you are trying to do will not work. .net DLLs cannot be used directly from Java with JNI. JNI can only load native DLLs.

You need a "bridge" dll, or library, meaning a native dll that loads the .net stuff for you. Then you use that native dll from JNI.

Take a look at this open source project: JNI4Net: bridge between Java and .NET (intraprocess, fast, object oriented, open-source)

It seems to do what you need.