The x86-x64 library wrapper for java (JNI)

I have an x86 dll for the transmitting device (possibly written in C ++, but of course there are no sources). My OS is Windows 7 x64. I also have a JVM x64. Is it possible with this x86 dll to do this using the x64 JVM to call native functions? The device manufacturer does not want to write the x64 version. Is it possible to write an x64 dll shell in C ++ that can call some required functions from an API in a dll and provide them externally?

Sort of:

Java Native Function Call -> MyX64DLLWrapper.dll -> OriginalX86Lib 
+4
source share
1 answer

You will need to use 32-bit native code from the 32-bit JVM. Either this, or write an external 32-bit program to provide an interface for the DLL, and run the program from the JVM and contact it. For example, you can do this through stdout / stdin. This is similar to the Erlang driver program, and the advantage of this approach is that it can provide a much more stable system. for example, if the driver program works, you can simply restart it from the JVM, it will not destroy the JVM.

Some tips for communicating with subprocesses are here: Running bash from Java

+2
source

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


All Articles