[Xotcl] Creating objects from C

Scott Gargash scottg at atc.creative.com
Fri Oct 27 18:38:11 CEST 2006


When creating XOTcl objects from C, it would be nice to be able to 
initialize the new object's clientData prior to any methods being invoked 
on the object.

Right now, the only way I can think of to do this is to 
1. create the object (which invokes "init", which can't rely on the 
ClientData)
2. XOTclSetObjectClientData( XOTclGetObject(), data); // Or the Class 
equivalent
3. Invoke some secondary, private "init"-like method that does true 
initialization

It would be nice to have two new exported functions:

int XOTclCreateObjectCl (Tcl_Interp* in, Tcl_Obj* name, ClientData data, 
struct XOTcl_Class* cl);
int XOTclCreateClassCl (Tcl_Interp* in, Tcl_Obj* name, ClientData data, 
struct XOTcl_Class* cl);

That initialize the XOTcl ClientData field prior to invoking "init" so 
that "init" could rely on the XOTcl ClientData being valid.  This would 
make it much easier to construct XOTcl wrappers around C/C++ objects. 

Is this reasonable? Is there a better way to accomplish this? 

        Scott

Notice 
The information in this message is confidential and may be legally 
privileged.  It is intended solely for the addressee.  Access to this 
message by anyone else is unauthorized.  If you are not the intended 
recipient,  any disclosure,  copying or distribution of the message,  or 
any action taken by you in reliance on it,  is prohibited and may be 
unlawful.  If you have received this message in error,  please delete it 
and contact the sender immediately.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://alice.wu-wien.ac.at/pipermail/xotcl/attachments/20061027/45cd4d9a/attachment.html


More information about the Xotcl mailing list