|
From: | Paolo Bonzini |
Subject: | Re: [Help-smalltalk] Using Smalltalk as a scripting language |
Date: | Thu, 29 Oct 2009 22:49:49 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4 |
On 10/29/2009 10:46 PM, Roland Plüss wrote:
When I get this correctly then this would be in fact gst_object_alloc( oopClass, numberOfCOnlyBytes ); where numberOfCOnlyBytes is the number of bytes I append to the struct which is not accessible to smalltalk. So far so right?
Yes, right. numberOfCOnlyBytes can actually be just sizeof (void *) with the C data stored "on the side". You choose (remember that if you place data in the Smalltalk object you have to deal with the GC moving the objects).
So I assume if I want to use this approach I have to provide a cCall for #new which creates the object using the prior mentioned gst_object_alloc bypassing the smalltalk creation call. Sounds like quite the hack but it looks like it could work out.
Doesn't seem to bad. Most likely you'd have a cCall for #initialize anyway. Having one for #new instead does not change much.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |