[Numpy-discussion] f2py and debug mode
ferdinand.bayard
ferdinand.bayard at strains.fr
Mon Oct 6 11:03:48 EDT 2014
Hello !
And thx for answering ! Meanwhile, I founded a solution for my problem : I
hacked some lines setting the compiler options in the f2py Python files,
which enables the generation of pdb files for debugging.
In msvc9compiler.py, line 432
self.ldflags_shared = ['/DLL', '/nologo', '/INCREMENTAL:no', *'/DEBUG',
'/pdb:link.pdb'*]
In IntelCompiler, line 155
def get_flags(self):
opt = ['/nologo', '/MD', '/nbs', '/Qlowercase',
'/us',*'/debug'*,'/Qmkl:parallel','/free']
I got another problem, I could not succeed in linking with external
routines. By example, for :
call system('....')
error LNK2019: unresolved external symbol _system.
(I get the same result with other libraries, even if I set the flags in
setup.py :
ext1 = Extension(name = moduleName,
sources = ...,
libraries = ...,
library_dirs = ...,
f2py_options = f2py_options)
Thx for your help.
Pearu Peterson-2 wrote
> Hi,
>
> 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.
>
> HTH,
> Pearu
>
> On Tue, Sep 30, 2014 at 4:15 PM, Bayard <
> ferdinand.bayard@
> > 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@
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
--
View this message in context: http://numpy-discussion.10968.n7.nabble.com/f2py-and-debug-mode-tp38736p38792.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
More information about the NumPy-Discussion
mailing list