Function CDM_LinkVar


Definition:#include <CDM.h>
Prototype:int CDM_LinkVar(Tcl_Interp *interp, char *tcl_var, char **c_var);
Arguments:

interp: A pointer to a Tcl interpreter. (Tcl_Interp *interp)
c_var: The address of the c variable to be linked (char **)
tcl_var: The name of the Tcl variable (char *)

C/C++ API Sections
Tcl API Sections
Description
Return Value
Notes
See Also
Index

Description:

This function links strings between C++ and Tcl. CDM_LinkVar uses variable traces to keep the Tcl variable named by "tcl_var" in sync with the C variable at the address given by "c_var". Whenever the Tcl variable is red the value of the C variable will be returned, and whenever the Tcl variable is written the C variable will be updated to have the same value.

Return Value:

CDM_LinkVar normally returns TCL_OK; if an error occurs while setting up the link (e.g. because "tcl_var" is the name of array) then TCL_ERROR is returned and an error message is placed in the provided Tcl interpreter.

Notes:

Note that the memory referenced by "c_var" must have been allocated with a call to either CDM_Malloc or Tcl_Alloc. "c_var" must never point to a staticly allocated buffer. "c_var" is allowed to have the value NULL as initial value. In this case it will be updated to point to a dynamicly allocated empty string.

If "interp" has the value NULL, the Tcl interpreter referenced by "CDM_Interp" will be used.

See Also:

CDM_Interp, Tcl_LinkVar


Generated by: petasis@aias on Wed Aug 16 10:31:57 PM EEST 2006.