diff --git a/C_C++/Tcl/return.c b/C_C++/Tcl/return.c new file mode 100644 index 0000000..2ed4d81 --- /dev/null +++ b/C_C++/Tcl/return.c @@ -0,0 +1,28 @@ +/* + * hello.c -- A minimal Tcl C extension. + */ +#include + +static int +Hello_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) +{ + Tcl_SetObjResult(interp, Tcl_NewStringObj("Hello, World!", -1)); + return TCL_OK; +} + +/* + * Hello_Init -- Called when Tcl loads your extension. + */ +int DLLEXPORT +Hello_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, "Hello", "1.0") == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_CreateObjCommand(interp, "hello", Hello_Cmd, NULL, NULL); + return TCL_OK; +}