Posted to tcl by jdc at Tue Apr 15 11:28:45 GMT 2008view raw

  1. #include "tcl.h"
  2.  
  3. #include <iostream>
  4.  
  5. extern "C" int example_test(ClientData clientData,
  6. Tcl_Interp* interp,
  7. int objc,
  8. Tcl_Obj* const objv[])
  9. {
  10. std::cout << "in example test!!!!!" << std::endl;
  11. return TCL_OK;
  12. }
  13.  
  14. extern "C" DLLEXPORT int Example_Init(Tcl_Interp *interp)
  15. {
  16. if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
  17. return TCL_ERROR;
  18. }
  19. if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL) {
  20. return TCL_ERROR;
  21. }
  22. if (Tcl_PkgProvide(interp, "example", "0.1") != TCL_OK) {
  23. return TCL_ERROR;
  24. }
  25.  
  26. Tcl_CreateObjCommand(interp, "example::test",
  27. (Tcl_ObjCmdProc*)example_test,
  28. (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  29.  
  30. return TCL_OK;
  31. }