views:

41

answers:

1

Hello,

For accessing FTDI USB boards from Java applications, I'm using the JD2XX driver wrapper (JD2XX.dll). It works very fine on 32-bit systems, but when it is loaded from a 64-bit JVM, it says it is impossible for a 64-bit JVM to load a 32-bit DLL. Very understandable. To get past this little problem, I install a 32-bit JVM on the 64-bit systems and it runs fine. Very simple solution, which can become very complicated to explain to a customer, though!

For this reason, I would like to create or otherwise obtain a 64-bit version of this JD2XX.dll file. I would like to know if someone ever did this successfully, or how I could proceed. I thought there should be a reference to the 32-bit dll in the ftdi-win32 project I could change for a 64-bit dll reference before recompiling everything on a 64-bit system, but I didn't find.

I would greatly appreciate any help about this. I don't feel like I'd find a way around this problem on my own anytime soon. The files I describe can be found in the most recent of these packages.

Thank you very much,

MJ

A: 

I finally managed to generate that 64-bit DLL file. ... :)

Here is how I obtained it:

  1. Downloaded the JD2XX package (the most recent is actually dated 20071214).
  2. Downloaded mingw-w64 (personal build sezero) and decompressed it in C:\ (giving C:\mingw64).
  3. Brought some modifications to the JD2XX package.
    • Adjusted Makefile.conf
      • Corrected MINGW and JDK paths according to my system.
      • Selected ftdi-win32 and amd64
    • Renamed the already generated 32-bit JD2XX.dll file so that make stops telling there is nothing to be done.
    • Renamed ftdi-win32/libftd2xx.a which is 32-bit... Replaced it by a copy of ftdi-win32/amd64/ftd2xx64.lib (renamed as libftd2xx.a, of course).
  4. Called C:\mingw64\bin\mingw32-make.exe from the main directory of the JD2XX package. This created a new JD2XX.DLL file which allows me to communicate with FTDI devices on my 64-bit computer without having to use a 32-bit JVM.

The generated file for download if anyone needs it.

M. Joanis
It was easy to add a switch in the JD2XX class (on the os.arch property) to load the 32-bit or the 64-bit DLL depending on the bitness of the running JVM (loadLibrary() call in the static block...).
M. Joanis