[Numpy-discussion] f2py and C functions/subroutines/structs

lorenzo bolla lbolla at gmail.com
Thu May 24 10:34:56 EDT 2007


I tried to write my own prova2.pyf and this is it:

----------------------------------------------------------------

!    -*- f90 -*-
! Note: the context of this file is case sensitive.

python module prova

interface

   function incr(x)
     real, dimension(2), intent(c) :: incr
     real, dimension(2), intent(c,in) :: x
   end function incr

   function incr0(x)
     integer intent(c) :: incr0
     integer intent(c,in) :: x
   end function incr0

   subroutine incr1(x)
     intent(c) :: incr1
     integer intent(c,in,out) :: x
   end subroutine incr1

end interface

end python module prova

! This file was auto-generated with f2py (version:2_3473).
! See http://cens.ioc.ee/projects/f2py2e/

----------------------------------------------------------------


Unfortunately, only the function incr0 works.
incr1 gives a segmentation fault and incr does not return an array (or
better a struct) as I would...
any hints?

thank you!
L.





On 5/24/07, Pierre GM <pgmdevlist at gmail.com> wrote:
>
> Lorenzo,
> you can indeed use f2py to write extensions around some C code:
>
> http://cens.ioc.ee/projects/f2py2e/usersguide/index.html
> http://www.scipy.org/Cookbook/f2py_and_NumPy
>
> I think you should also be able to find some actual examples in the scipy
> sources...
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070524/7645c3bf/attachment.html>


More information about the NumPy-Discussion mailing list