build c as lib, and use in tcl
#include <tcl.h>
static int
Ztcllib_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Tcl_SetObjResult(interp, Tcl_NewStringObj("test!", -1));
return TCL_OK;
}
/*
* Ztcllib_Init -- Called when Tcl loads your extension.
*/
int DLLEXPORT
Ztcllib_Init(Tcl_Interp *interp)
{
if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
return TCL_ERROR;
}
/* changed this to check for an error - GPS */
if (Tcl_PkgProvide(interp, "ztcllib", "1.0") == TCL_ERROR) {
return TCL_ERROR;
}
Tcl_CreateObjCommand(interp, "ztcllib", Ztcllib_Cmd, NULL, NULL);
return TCL_OK;
}