Forum OpenACS Development: Help needed to create TCL list in a TCL appilcation..


I am using the following code snippet to create a list
by name mylist.

ANy help on this would be great !

Looking forward to seee the response for these ...


char **varlist;

  char *mylist;

  varlist = (char ** )malloc(10);

  varlist[1] = (char *) malloc(10);
  varlist[2] = (char *) malloc(10);


  mylist = Tcl_Merge(3,(const char* const*)varlist);


Posted by Sans Su on
After running application crashes.
Hi Sans Su,

most of the developers on only use the tcl language itself - we don't generally implement tcl functions in C.

Maybe you might want to take a look at the tcl related mailing lists on ASPN:

The Tcl and AOLserver sources both have examples of using Tcl_Merge(), try looking there. E.g.:

$ find . -name "*.c" -print | xargs grep Tcl_Merge
./tcl8.4/mac/tclMacBOAMain.c:    args = Tcl_Merge(argc-1, argv+1);
./tcl8.4/generic/tclMain.c:    args = Tcl_Merge(argc-1, (CONST char **)argv+1);
./tcl8.4/generic/tclStubInit.c:    Tcl_Merge, /* 192 */
./tcl8.4/generic/tclTest.c:    cmd = Tcl_Merge(3, listArgv);
./tcl8.4/generic/tclTest.c:    argString = Tcl_Merge(argc-1, argv+1);
./tcl8.4/generic/tclThreadTest.c:	script = Tcl_Merge(3, argv);
./tcl8.4/generic/tclUtil.c: * Tcl_Merge --
./tcl8.4/generic/tclUtil.c:Tcl_Merge(argc, argv)
./nsd/tclxkeylist.c:        newField = Tcl_Merge(2, (CONST char**)elemArgv);
./nsd/tclxkeylist.c:        newField = Tcl_Merge(2, (CONST char**)elemArgv);
./nsd/tclxkeylist.c:    newList = Tcl_Merge(fieldInfo.argc, (CONST char**)fieldInfo.argv);
./nsd/tclxkeylist.c:            newElement = Tcl_Merge(2, (CONST char**)elemArgv);
./nsd/tclxkeylist.c:    newList = Tcl_Merge(fieldInfo.argc, (CONST char**)fieldInfo.argv);
./nsd/tclxkeylist.c:    Tcl_SetResult(interp, Tcl_Merge(keyesArgc, (CONST char**)keyesArgv), TCL_DYNAMIC);