[squeak-dev] FFI related questions

vagy vagy at freemail.gr
Tue Jan 5 19:41:48 UTC 2010


On Tue, 05 Jan 2010 20:20:07 +0200, Nicolas Cellier  
<nicolas.cellier.aka.nice at gmail.com> wrote:

> 2010/1/5 vagy <vagy at freemail.gr>:
>> Igor Stasenko wrote:
>>>
>>> The difference between FloatArray and Array of floats (or array of
>>> arbitrary objects)
>>> is in storage format. While first storing a number of native
>>> floating-point values, edigible for C,
>>> while second stores references to other objects (oop-s).
>>
>> Indeed and this means that we can change values in C land when they
>> are contained in said Arrays (ByteArray, FloatArray, IntegerArray, etc)
>> but not when sent down as single values, which strikes me as kinda
>> inconsistent, at least from an FFI usage point of view.
>> A bit OT, speaking of FloatArray, it changes the Floats you put into it
>> into single precision. So currently it is impossible to pass to C an  
>> array
>> of double precision Floats. Shouldn't the image also have a DoubleArray  
>> for
>> that purpose?
>>
>
> See how I did this in Smallapack-Collections
> http://www.squeaksource.com/Smallapack.html
> I created an ExternalArray and various subclasses.
>
> Nicolas

Thanx for the tip. I saw your code, though i was thinking more
along the lines of having a standard DoubleArray implementation in the  
image
as we have for 32bit Floats. I just saw that FloatArray is implemented in
terms of variableWordSubclass but there is no variableDoubleWordSubclass
which, at first glance, may make the whole issue of having a standard
DoubleArray non trivial. I think we need the opinion of a VM expert here.
In any way, what do you think about having a standard DoubleArray?

Cheers
  - Vagelis




More information about the Squeak-dev mailing list