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: Paolo Bonzini
Subject: Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language
Date: Fri, 30 Oct 2009 23:21:47 +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


Got stumped :( . I forgot that the class I try to wrap right now is a
singleton. With other words in that case I need to assign a c-pointer
somehow to the class itself not the instance of it. But the class object
is created by smalltalk so I can't mess with it.

No. Even if it is a singleton, *never* place singleton methods on the class side. Add a #uniqueInstance class method cCall and use gst_register_oop to ensure that the singleton instance is not garbage collected.

So basically I need to mess with the STSomething object. Can I do the
same hack you mentioned simply for STSomething like this?

Object subclass: STSomething [
     STSomething class [
         <shape: #byte>
         new [<cCall: 'CSomething_new' returning: #void args: #(#self)>  ]
     ]
]

I answered above, but probably you want "returning: #smalltalk args: #(#selfSmalltalk)" in general.

Paolo




reply via email to

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