[f2py] wrapping c with f2py
Ariel Balter <ariel-ZF+EKEZ8/[email protected]>
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Stunned by the almost instantaneous response!
Yes, installing python-dev did make that example work. So, my system
appears to be able to handle the necessities now. Thanks!
Now, perhaps you can please help me with this slightly more elaborate
example:
// ------------ cadd.c ------------------- //
#include <stdio.h>
#include <stdlib.h>
int cadd(int a, int b){
int c = a + b;
printf("sum of %i and %i is %i\n", a, b, c );
return c;
}
// -------------------------------------------- //
# -------------- padd.pyf -------------- #
python module padd
interface
function cadd(a, b, c) result c
integer intent(c) cadd
integer intent(c) a
integer intent(c) b
integer intent(c) c
end function cadd
end interface
end python module padd
# ----------------------------------------- #
I can compile with "f2py -c pyadd.pyf cadd.c" just fine. BUT, when I
try to import into python, I get:
> >>> import padd
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: ./padd.so: undefined symbol: unknown_function_
I've tried a couple of different formats for the PYF file, but I don't
seem to have found the right approach.
Thanks much, 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-Y2zl/[email protected]
www.arielbalter.com
www.pnl.gov