View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] Creating objects from C

From: Scott Gargash <scottg_at_atc.creative.com>
Date: Fri, 27 Oct 2006 09:38:11 -0700

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.