I am trying to use f2py to interact with my python programs with my Fortran modules.
I am on a Win7 platform.
I am using the latest version of Anaconda 64 (1.7) as a Python + NumPy stack.
My Fortran compiler is the latest Intel Fortran 64 compiler (version 14.0.0.103 Build 20130728).
I had a lot of problems running f2py -c -m PyModule FortranModule.f90 --fcompiler=intelvem
The last one, which I do not seem to understand, is that it looks like the sequence of f2py / distutils flags passed to the compiler does not meet ifort expectations.
I get a series of warning messages about unknown parameters when calling ifort.
ifort: command line warning #10006: ignoring unknown option '/LC:\Anaconda\libs' ifort: command line warning #10006: ignoring unknown option'/LC:\Anaconda\PCbuild\amd64' ifort: command line warning #10006: ignoring unknown option '/lpython27'
I suspect this is due to errors that I get from the linker at the end
error LNK2019: unresolved external symbol __imp_PyImport_ImportModule referenced in function _import_array error LNK2019... and so forth (there are about 30-40 lines like that, with different python modules missing)
and ends simple
fatal error LNK1120: 42 unresolved externals
I assume this is because the / link flag is missing in the parameter sequence. Because of this, the / l / L options are not passed to the linker, and the compiler thinks they are addressed to it.
The ifort command generated by f2py looks like this:
ifort.exe -dll -dll Pymodule.o fortranobject.o FortranModule.o module-f2pywrappers2.o -LC:\Anaconda\libs -LC:\Anaconda\PCbuild\amd64 -lPython27
I do not know why "-dll" is repeated twice (I had to change this flag from the original "-shared").
Now I tried to learn the f2py and distutils codes, but did not understand how to add an extra / link to the output of the command. I could not even find where this output is generated.
If someone has encountered this problem in the past and / or may have some suggestions, I would really appreciate it.
thank you for your time