Posted to tcl by jdc at Tue Apr 15 11:28:45 GMT 2008view raw
- #include "tcl.h"
- #include <iostream>
- extern "C" int example_test(ClientData clientData,
- Tcl_Interp* interp,
- int objc,
- Tcl_Obj* const objv[])
- {
- std::cout << "in example test!!!!!" << std::endl;
- return TCL_OK;
- }
- extern "C" DLLEXPORT int Example_Init(Tcl_Interp *interp)
- {
- if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
- return TCL_ERROR;
- }
- if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL) {
- return TCL_ERROR;
- }
- if (Tcl_PkgProvide(interp, "example", "0.1") != TCL_OK) {
- return TCL_ERROR;
- }
- Tcl_CreateObjCommand(interp, "example::test",
- (Tcl_ObjCmdProc*)example_test,
- (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
- return TCL_OK;
- }