I installed the 32 bit version of Mingw 4.7.2 (using the installer) on my Windows 7 64 bit. I use MinGW in an Eclipse C++ project in order to build a .dll file. So far everything works.
However I use this .dll to be included in a java project via JNI. And when I call a function of the .dll in the java project the exception "Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\path\mylib.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform"
is thrown.
So it seem like I need to build an 64 bit version of the DLL.
So my questions are:
Regards Marc
Edit: As you can see in the comment below, I already tried to set the -m64 Flag to build a 64 bit dll. This results in the error: "sorry, unimplemented: 64-bit mode not compiled in"
.
So is there a way to get the 64 bit mode running in mingw32.
Additionally, a 32-bit process cannot load a 64-bit DLL. However, 64-bit Windows supports remote procedure calls (RPC) between 64-bit and 32-bit processes (both on the same computer and across computers).
MinGW can be run either on the native Microsoft Windows platform, cross-hosted on Linux (or other Unix), or "cross-native" on Cygwin. Although programs produced under MinGW are 32-bit executables, they can be used both in 32 and 64-bit versions of Windows.
Solution. You cannot call a 64-bit DLL from 32-bit LabVIEW. This is a limitation of 64-bit Windows, which does not support mixed 64-bit/32-bit processes. The recommended solution is to recompile the DLL from the source code for a 32-bit target architecture.
open a cmd.exe and do set PATH=C:\mingw64\bin;%PATH% for 64-bit building. set PATH=C:\mingw32\bin;%PATH% for 32-bit building. You should be ready to go.
I recently faced the same problem, installing the MinGW-64
version enabled the -m64
flag for me. You can get an automated build from here.
EDIT : Some guy (rubenvb
) made some good job in the Personal Builds
:
There's gcc 4.7.4 here and even 4.8.0 here.
You can download the TDM-GCC compiler with a nice easy Windows installation from http://tdm-gcc.tdragon.net/.
Then you can run the following to generate a 64-bit C Code Object file from the C Code Source File HelloWorld.c.
"C:\MinGW64\bin\gcc.exe" -m64 -c -I"C:\Program Files\Java\jdk1.6.0_26\include" -I"C:\Program Files\Java\jdk1.6.0_26\include\win32" HelloWorld.c
This should be run from the same directory as HelloWorld.c and will generate the HelloWorld.o file in that directory. The -m64
makes it 64 bit. You can specify -m32
to make a 32 bit object file and specify -o
, to give the output as mentioned in the comment above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With