Re: [f2py] mixed f77/f90 code
Jasper Werhahn <[email protected]> Wed, 24 Nov 2010 01:14:04 -0800
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
2010/11/24 Pearu Peterson <[email protected]> > > > On 11/24/2010 10:41 AM, Jasper Werhahn wrote: > > dear pearu, > > > > thanks a lot. i just don't understand one thing - i do of course only > > call fit_gm from python. but fit_gm itself continues to call the > > lmder-subroutines that actually do the fitting. how do i get this passed > > on then? greetings, > > As I read the code, fit_gm uses gMorse as a callable argument to lmder > subroutines. Since Morse_mod.f90 is linked to the generated extension > module then all bits are there for fit_gm. May be I should clarify that > f2py builds wrappers to fortran subroutines, f2py does not convert > fortran codes to python. A wrapper is a lightweight C function that > converts Python objects to C objects that can be passed on to Fortran > subroutines. > > Regards, > Pearu > yes, you read the code right. this seems to make perfect sense. can i find details of how to link the wrapped fit_gm subroutine to the actual fitting then? if i build the wrapper from only fit_gm and morse_mod according to your instructions, making sure that only these functions and subroutines are included in the pyf file, it builds the .so-file. when i import that in python via from fit_gm import *, python gives me the error message: Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: dlopen(./fit_gm.so, 2): Symbol not found: _lmder1_ Referenced from: /Users/umbra/Desktop/test/fit_gm.so Expected in: dynamic lookup no reference to lmder1 is made in my pyf-file (i grepped it to make sure). Dipl.-Phys. Jasper Werhahn TU Muenchen, Physikdepartment E11 James-Franck-Strasse 85748 Garching Germany _______________________________________________ f2py-users mailing list f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] http://cens.ioc.ee/mailman/listinfo/f2py-users