>> Something I didn't understand on the way you manipulate ST data from C?
>
> You forgot the instance variables defined by superclasses of "DEEngine
> class". Better initialize uniqueInstance lazily:
>
> DEEngine class [
> | uniqueInstance |
> uniqueInstance [ ^uniqueInstance ifNil: [self new] ]
> new [ <cCall: 'DEEngine.new' returning: #smalltalk args: #() ]
> ]
>
> ...
>
> // in the creation function
> OOP oopClass = gst_class_name_to_oop( "DEEngine" );
> deEngine::m_stUniqueInstance = pST->CreateNewObject( oopClass );
> gst_register_oop (deEngine::m_stUniqueInstance);
>
> ...
>
> static OOP deEngine::stNew ()
> {
> return deEngine::m_stUniqueInstance;
> }
>
> ...
>
> gst_define_cfunc ("DEEngine.new", deEngine::stNew);
>
> Nice to see some code in this thread!
>
Nice try but this won't work. I have an engine pointer and therefore can
not use a singleton in c++ ( although in smalltalk it becomes one ).
Hence I am forced to work without any static class members there. The
only chance I have to get this working is to somehow inject the created
object into the class side variable. This would by itself work if the
oop I assign would actually show up in smalltalk. I don't know yet why
it stays nil. Did I obtain the wrong c pointer? Did I declare the class
side variable incorrectly?-- 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
