help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language


From: Roland Plüss
Subject: Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language
Date: Sat, 31 Oct 2009 02:43:59 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090926)

>> 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 )

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]