[Newbies] [Q] How can I write down my FFI method for this C function?

Sungjin Chun chunsj at gmail.com
Fri Mar 4 07:09:20 UTC 2011


Hi,

The C function is like this;

BOOL ComputeVector (int startIdx, int endIdx, double *inputSeries, int
duration, int *outBeginIdx, int *outNBElement, double *outSeries);

My trial method is

apiComputeVectorWith: startIdx with: endIdx with: input duration:
duration with: outBeginIdx with: outNBElement out: out
    <cdecl: bool 'ComputeVector' (long long double* long long* long* double*)>

But with these input variable, I got error with "could not coerce arguments".

input := ((1 to: 100) collect: [ :i | i ]) asFloatArray.
startIdx := 0.
endIdx := input size - 1.
duration := 4.
outBeginIndx := IntegerArray new: 1.
outNBElement := IntegerArray new: 1.
out := FloatArray new: input size.
computer apiComputeVectorWith: startIdx with: endIdx with: input
duration: duration with: outBeginIdx with: outNBElement out: out.

Can anyone help me on this? Thank you in advance.


More information about the Beginners mailing list