[f2py] wrapping c with f2py

Pearu Peterson pearu.peterson at gmail.com
Tue Nov 24 09:36:14 EET 2009


Hi,

The example works fine here with:
$ f2py -v
2_6882

What f2py version are you using?

Pearu

Ariel Balter wrote:
> Hi,
> I am trying to wrap c code with f2py.  I have found a couple of
> resources such as
> http://www.scipy.org/Cookbook/f2py_and_NumPy
> and this post
> http://cens.ioc.ee/pipermail/f2py-users/2005-February/001059.html
> 
> Since I am writing, you might guess I'm having some trouble.  I'm
> running ubuntu 9.10 and compiling with gfortran and gcc.  My python
> version is 2.6.4.
> 
> Here are my files:
> 
> // ---------- f2ctest.c ----------- //
> #include<stdio.h>
> 
> int f2ctest(int num)
> {
>  printf( "Test:%i",num);
>  return -1;
> }
> 
> // --------------------------------- //
> 
> #-------- f2c.pyf ----------- #
> python module f2c
>  interface
>    function f2ctest(num)
>      intent(c) f2ctest
>      integer f2ctest, num
>      intent(c) num
>    end function f2ctest
>  end interface
> end python module f2c
> #------------------------------- #
> 
> These are just the 2 example files in the post.  However, when I run
> "f2py -c f2c.pyf f2ctest.c", I get a lot of very bad looking output,
> full of the ominous word "error".  Since you probably have nothing
> better to do than to read it, I have attached it.
> 
> I would have posted this to the f2py forum, but I sincerely can't figure
> out how.  I got this by clicking on your email link on the above post.
> 
> Cheer, Ariel
> 
> -- 
> /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
> 
> Ariel I Balter, Ph.D.
> Postdoc
> Biological Monitoring/Modeling
> Fundamental and Computational Sciences Directorate
> 
> Pacific Northwest National Laboratory Mail:
> PO Box 999, MS P7-58,Richland, WA 99352
> Shipping:
> 790 6th Street, MS P7-58, Richland, WA 99354
> 
> Tel:  509-376-7605 Cell:  509-713-0087
> ariel.balter at pnl.gov <mailto:ariel.balter at pnl.gov>
> www.arielbalter.com <http://www.arielbalter.com>
> www.pnl.gov <http://www.pnl.gov> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> f2py-users mailing list
> f2py-users at cens.ioc.ee
> http://cens.ioc.ee/mailman/listinfo/f2py-users



More information about the f2py-users mailing list