[f2py] convert C code to python module [newby]
MOROIANU Dragos
dmoroian at yahoo.com
Wed Mar 23 21:56:08 EET 2005
Hello everybody,
I just installed on my computer f2py2.1 and I want to
include in python, some of the functions that I have
written in C. In the documentation is mentioned that
this is possible but all the examples available are
using fortran sources. Can anyone tell me how to do
the simplest conversion? Someting like the hello.f but
written in C:
#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 1;
}
I tried the following:
f2py2.1 -c -m hello hello.c
hello.c:4: warning: function declaration isn't a
prototype
and then:
Python 2.1.3 (#1, Sep 7 2002, 15:29:56)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "copyright", "credits" or "license" for more
information.
>>> import hello
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: dynamic module does not define init
function (inithello)
>>> hello.main
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 'hello' is not defined
>>> hello.main()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 'hello' is not defined
>>>
I will really appreciate your help because I was not
able to find this information with google (only an
example since 2003 where it said that I should write
my self a '.pyf' file)!
Dragos
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
More information about the f2py-users
mailing list