returning a string from a primitive
John M McIntosh
johnmci at smalltalkconsulting.com
Mon Mar 5 21:15:03 UTC 2007
Well of course memcpy work *better* versus writing a loop and doing
it yourself.
memcpy might even be optimized for your hardware too.
Of course make sure you don't copy a few too many bytes, or bytes to
the wrong place.
There is also the ExernalAddress class, but I've not played with
that, I guess you could make one of those
On Mar 5, 2007, at 8:23 AM, Bert Freudenberg wrote:
> On Mar 5, 2007, at 17:14 , Diman Todorov wrote:
>
>> Hello,
>> I am currently struggling to return a string from a virtual
>> machine primitive. The only example derived from
>> SmarySyntaxInterpreterPlugin I was able to find in the Squeak
>> sources is in the InternetConfigPlugin (in
>> primitiveGetStringKeyedBy:). This Plugin instantiates a new string
>> object and explicitly iterates over the string to copy it to
>> squeak. Isn't there a more elegant way to return a string from a c
>> function?
>
> You have to copy the data into a proper oop in Squeak's object
> memory. What "more elegant way" to do that are you proposing? You
> can write a helper function of course. But eventually it will have
> to copy.
>
> - Bert -
>
>
>
--
========================================================================
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
========================================================================
===
More information about the Squeak-dev
mailing list
|