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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Sungjin Chun
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.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners