New issue 29 by brunodechamp: "ImportError: DLL load failed: %1 is not a
valid Win32 application" with gnu95
http://code.google.com/p/f2py/issues/detail?id=29
Hello,
I am able to generate, but not to use the DLLs generated by f2py, in
Fortran 90.
Here is my system:
- Windows Vista Business 64 bits
- Python 2.6.5
- numpy 1.5.1rc1
- scipy 0.8.0
- MinGW + gfortran
So to begin with, I wrote a hello.f Fortran file
(http://www.scipy.org/F2py). Then I compiled it into a python module using
the following command:
f2py.py -c --fcompiler=gnu95 --compiler=mingw32 -lmsvcr71 -m hello hello.f
Up to here, everything's alright. However, when I try "import hello" from
Python, then I get the following error:
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: DLL load failed: %1 is not a valid Win32 application
On the other hand, everything works fine if I use the gnu compiler (not
gnu95) without the -lmsvcr71 option:
f2py.py -c --fcompiler=gnu --compiler=mingw32 -m hello hello.f
The problem is that I need to wrap plenty of Fortran 90 code, not Fortran
77...
Help please!!
Thanks in advance
Bruno
Actually I think the problem comes from gfortran itself... Windows won't
run any program built with gfortran.
Googling around shows that this error message is related to mixing 32 and
64 bit codes.
Check if there are 32 and 64 bit differences in python, g77, and gfortran
programs.
For instance, if you are using 32 bit python then you must also use 32 bit
gfortran.
If you need 64 bit, then both python and gfortran must be 64 bit programs.
If this information is not helpful then try also f2py-users mailing list.
Perhaps you have 32 bit gfortran then.
Thanks, problem solved!!
As you said, I think that my installations of MinGW and gfortran were not
consistent (one 32 bit, the other 64 bit, or maybe versions inconsistency).
So I uninstalled and reinstalled them, and everything works fine --
including f2py (which was not the culprit, anyway)!
thanks again
Comment #5 on issue 29 by pearu.peterson: "ImportError: DLL load failed: %1
is not a valid Win32 application" with gnu95
http://code.google.com/p/f2py/issues/detail?id=29
(No comment was entered for this change.)