[f2py] callback - integer conversion

pearu at cens.ioc.ee pearu at cens.ioc.ee
Fri Feb 11 20:18:07 EET 2005


On Fri, 11 Feb 2005, Mike Müller wrote:

> Just exploring callback functions.
> 
> I have the following f90 example:
> 
> subroutine pcg_wrapper(ae_func)
>    external ae_func
>    integer:: ok = 0
> 
>    write(*,*) 'ok', ok
>    ok = ae_func()
>    write(*,*) 'ok', ok
> 
> end

> Is there something I have to specify somewhere to make the integer work?

You'll need to specify that ae_func is a function returning integer, not
real as follows from default implicit rules. So, try

subroutine pcg_wrapper(ae_func)
   external ae_func
   integer ae_func
   integer:: ok = 0
   
   write(*,*) 'ok', ok
   ok = ae_func()
   write(*,*) 'ok', ok
   
end

Pearu




More information about the f2py-users mailing list