>> 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). What exactly you mean with "moving"? I'm not referencing to data inside the custom data area using pointers. Most of the time I simply store there a pointer to the wrapped engine object. Sometimes it's two pointers ( required if a non-ref-counted object is stored which is located inside a ref-counted object so I store two pointers one with ref-counting to guard the second non-ref-counted one ). So as long as the data is just copied nothing bad should happen. >> 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. > To my understanding ( from past smalltalk lectures at university where we worked with Squeak ) #new is responsible for allocating an object while #initialize or #init is responsible for setting up default values for the newly created instance. Therefore I proposed #new. Unless that is in GST this rule is slightly different.
-- Yours sincerely Plüss Roland Leader and Head Programmer - Game: Epsylon ( http://epsylon.rptd.ch/ , http://www.moddb.com/games/4057/epsylon ) - Game Engine: Drag(en)gine ( http://dragengine.rptd.ch , http://www.moddb.com/engines/9/dragengine ) - Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php )
signature.asc
Description: OpenPGP digital signature
_______________________________________________ help-smalltalk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-smalltalk
