Re: [Xotcl] Device chaining from Objects/Classes defined in C
Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM
Date: Sat, 23 Sep 2006 13:01:57 -0700
xotcl-bounces_at_alice.wu-wien.ac.at wrote on 09/15/2006 12:28:50 PM:
> I have some classes that are defined in C using the xotcl (cersion
> 1.4) C API. Things seem to work (I can create objects and invoke
> methods), but I can't get chaining to function. I can invoke the
> "next" command (using Tcl_Eval( interp, "xotcl::next")), but that
> fails with "next: can't find self"
Just a followup for anybody searching the mailing list archives.
XOTcl requires the Tcl stack to contain information about the executing
object in order to resolve the net method. By default, and prior to
1.5.1, C methods do not annotate the Tcl stack with the approriate
information to allow method chaining to work.
As of 1.5.1, C methods can be registered with an additional flag,
XOTCL_NONLEAF_METHOD. When a method with this flag is invoked the Tcl
stack will include the information needed to allow "next" to function
properly.
In addition to the new flag, 1.5.1 exports a couple of additional C
functions to improve the performance of the XOTcl at the C-interface.
XOTclNextObjCmd() - invoke "xotcl::next" at the C-level without an
additional interpreter evaluation
XOTclCallMethodWithArgs() - invoke a method without an additional
interpreter evaluation