How to access classes and methods of a native vb.net DLL file from jna or another library

What i have
a) I used the jna library.
b) My dll is a native vb.net DLL file.
c) You can check this link for more information on the dll link

My source code is as follows

Interface

package com.dll.lib; import com.sun.jna.Library; import com.sun.jna.Native; public interface BrowseControl extends Library { BrowseControl instance = (BrowseControl)Native.loadLibrary("Vertex FXBOAPI10.5.9", BrowseControl.class); } 

Class

 package com.dll.main; import com.dll.lib.BrowseControl; public class MainTest { public static void main(String[] args) { BrowseControl control=BrowseControl.instance; System.out.println("Brwoser: "+control.getClass()); } } } 

This code works.

What I want
a) how to access my classes and methods from a dll in the Java programming language?

b) how to refer to the {VertexFX Backoffice API} Dll, then define an Object of type type CVertexFXBOAPI class, then call the Object.SetLoginInfo and Object.Login

thanks

+5
source share
1 answer

Yo can use native code from a shared library through JNI. JNI provides a bridge between Java and your code. However, you must make sure that you maintain a naming convention for your own routines.

In your case (where you have a DLL with your own code that you want to call) you can go through the JNI shell that will encode the code. This way you can leave the DLL as it is.

Check out the sample code here, where:

http://jnicookbook.owsiak.org/recipe-No-018/

This is not exactly what you are looking for (since the code is for macOS / Linux), but the circuit will be very similar.

The JNI shell (called Java) - this will be the native code - will load the existing library (which is inside the DLL created by someone else). Then you will need to call the function from this DLL.

0
source

Source: https://habr.com/ru/post/1266455/


All Articles