[f2py] wrapping c with f2py

Ariel Balter ariel at arielbalter.com
Tue Nov 24 07:51:50 EET 2009

I am trying to wrap c code with f2py.  I have found a couple of 
resources such as
and this post

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 ----------- //

int f2ctest(int num)
 printf( "Test:%i",num);
 return -1;

// --------------------------------- //

#-------- f2c.pyf ----------- #
python module f2c
   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.
Biological Monitoring/Modeling
Fundamental and Computational Sciences Directorate

Pacific Northwest National Laboratory Mail:
PO Box 999, MS P7-58,Richland, WA 99352
790 6th Street, MS P7-58, Richland, WA 99354

Tel:  509-376-7605 Cell:  509-713-0087
ariel.balter at pnl.gov

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cens.ioc.ee/pipermail/f2py-users/attachments/20091123/a183e413/attachment-0001.htm 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: log
Url: http://cens.ioc.ee/pipermail/f2py-users/attachments/20091123/a183e413/attachment-0001.txt 

More information about the f2py-users mailing list