Passing an array to a C function (using SWIG)
aiglauer
aiglauer at iname.com
Sat Aug 12 18:10:26 EDT 2000
Hi
Sorry if this is a dumb question but I have RTFM'd a fair amount in the
Embedding Guide and the SWIG manuals and segfaulted a lot more and
can't get this figured out......
I need to pass an array of floats (length only known at runtime) to a C
function (Calculation intensive recursive algorithm which is too slow
for me in Python) and then return an array of floats.
C Function definition:
float *panjer(float *probs, long maxTot)
SWIG wraps all pointers as strings - but I can't find an explanation of
how to actually get an array INTO the C function. Can anyone help me
here? I could probably do away with SWIG as I only have the one
function to worry about and could do this by hand - SWIG just seems
very elegant.
If I do this by hand, what would a Python List/Array look like if I
pass it to my C function and how would I do this? I saw a previous
thread which said you could use the C API to read the paramaters one by
one - anyone have details?
Thanks
Alexis
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list