You would pass in a ByteArray. You can populate the ByteArray like this:
ba := ByteArray new: 8 * 3. "3 is number of elements" useBigEndian := true. "or false, depending on what kind of machine you are on" ba doubleAt: 1 put: 1.0 bigEndian: useBigEndian. ba doubleAt: 9 put: 4.55555555 bigEndian: useBigEndian. ba doubleAt: 17 put: 3.0001 bigEndian: useBigEndian. someObj primitiveDoSomethingWithDoubles: ba
Your primitive would need to get a pointer to the actual data in the ByteArray (see senders of #firstIndexableField:), and cast it to (double*).
Hope this helps, Josh
Ang Beepeng wrote:
I am writing a plugin. How do I pass starray := {1.0. 4.5555555. 3.0001.}. to double * carray.
Thanks.
Ang Beepeng