简体   繁体   中英

x86 to x64 library wrapper for java (JNI)

I have an x86 dll for an transmitter device (possibly written in C++, but there are no sources of course). My OS is Windows 7 x64. I have JVM x64 too. Is it possible to do smth with this x86 dll to use it with x64 JVM for native function call? The device manufacturer doesn't want write x64 version. Is it possible to write a x64 dll wrapper in C++, that could call some required functions from the API in the dll and provide them to outside?

Something like:

Java Native Function Call -> MyX64DLLWrapper.dll -> OriginalX86Lib

You're going to have to use the 32-bit native code from within a 32-bit JVM. Either that or write an external 32-bit program to provide an interface to the dll, and the launch the program from the JVM and communicate with it. For example, could do this through stdout/stdin. This is similar to an Erlang driver program, and an advantage to this approach is that it can make for a much more stable system. eg if the driver program crashes you can just restart it from the JVM, it won't take down the JVM.

Some advice for communicating with sub-processes is here: Running bash from Java

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM