Hi all,
I hope this is the right mailing list to post my question to.
I'm trying to make some easy C code working with Python by using f2py.

For example, take the test.c file:

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

typedef struct data {
    int a;
    double b;
} DATA;

/*function with struct*/
DATA incr(DATA x) {
    DATA y;
    y.a = x.a + 1;
    y.b = x.b + 1.;
    return(y);
}

/*function: return value*/
int incr0(int x) {
    return(x+1);
}

/*subroutine: no return value*/
void incr1(int *x) {
    *x += 1;
}
----------------------------------




If I do:
$ f2py -c test.c -m prova
all seems fine, but inside ipython I get this error:

In [1]: import prova
---------------------------------------------------------------------------
<type 'exceptions.ImportError'>           Traceback (most recent call last)

/xlv1/labsoi_devices/bollalo001/work/test/python/<ipython console> in
<module>()

<type 'exceptions.ImportError'>: dynamic module does not define init
function (initprova)


I think I'm missing a correct .pyf file to do:
$ f2py -c prova2.pyf test.c

I tried writing prova2.pyf by my own, because doing:
$ f2py test.c -h prova2.pyf -m prova
gives me an empty prova2.pyf, but I wasn't able to do it!!!

Can anyone of use kindly show me how to write it? Or giving me a good
tutorial to read? I found only very few information on www.scipy.org.

Thank you in advance,
Lorenzo.
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to