Help with FFI - another try

John M McIntosh johnmci at smalltalkconsulting.com
Wed Jul 19 20:13:10 UTC 2006


So how many bytes are being allocated here?
how many bytes do you expect to write into that location?
Are these bytes, or words you're expecting?   1 word -> 4 bytes?

On 19-Jul-06, at 4:40 AM, Eugene Beschastnov wrote:

> And I'm trying to call it in following way:
> 	pMp3Buffer := ByteArray new: dwMp3Buffer.


Lastly I'll note that

mp3Output addAll: (pMp3Buffer copyFrom: 1 to: pDwWrite first)].

could be expressed as this, since the copyFrom:to: makes a new object  
of the same class as the original,
no need to stuff that new object into  mp3Output.

mp3Output := pMp3Buffer copyFrom: 1 to: pDwWrite first.

regarding

pDwWrite first

Ah, likely you should do
pDwWrite := ByteArray new: 4.

then say pDwWrite signedLongAt: 1
if it's  a signed long in platform endian you expect to find there,  
this is clearer than hoping the
value you got stuff in there is an integer of some sort in the right  
endian format.


--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===





More information about the Squeak-dev mailing list