[Numpy-discussion] f2py and debug mode

Pearu Peterson pearu.peterson at gmail.com
Fri Oct 3 15:38:03 EDT 2014


When you run f2py without -c option, the wrapper source files are generated
without compiling them.
With these source files and fortranobject.c, you can build the extension
module with your specific compiler options using the compiler framework of
your choice.
I am not familiar with Visual Studio specifics to suggest a more detailed
solution but after generating wrapper source files there is no f2py
specific way to build the extension module, in fact, `f2py -c` relies on
distutils compilation/linkage methods.


On Tue, Sep 30, 2014 at 4:15 PM, Bayard <ferdinand.bayard at strains.fr> wrote:

> Hello to all.
> I'm aiming to wrap a Fortran program into Python. I started to work with
> f2py, and am trying to setup a debug mode where I could reach
> breakpoints in Fortran module launched by Python. I've been looking in
> the existing post, but not seeing things like that.
> I'm used to work with visual studio 2012 and Intel Fortran compiler, I
> have tried to get that point doing :
> 1) Run f2py -m to get *.c wrapper
> 2) Embed it in a C Project in Visual Studio, containing also with
> fortranobject.c and fortranobject.h,
> 3) Create a solution which also contains my fortran files compiled as a lib
> 4) Generate in debug mode a "dll" with extension pyd (to get to that
> point name of the "main" function in Fortran by "_main").
> I compiled without any error, and reach break point in C Wrapper, but
> not in Fortran, and the fortran code seems not to be executed (whereas
> it is when compiling with f2py -c). Trying to understand f2py code, I
> noticed that f2py is not only writing c-wrapper, but compiling it in a
> specific way. Is there a way to get a debug mode in Visual Studio with
> f2py (some members of the team are used to it) ? Any alternative tool we
> should use for debugging ?
> Thanks for answering
> Ferdinand
> ---
> Ce courrier électronique ne contient aucun virus ou logiciel malveillant
> parce que la protection avast! Antivirus est active.
> http://www.avast.com
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141003/6b50e2aa/attachment.html>

More information about the NumPy-Discussion mailing list