Posted to tcl by hat0 at Mon Nov 05 04:20:13 GMT 2007view raw

  1. Here is awesome.c:
  2.  
  3. -----
  4. #include <stdio.h>
  5. #include <tcl.h>
  6.  
  7.  
  8. static int be_awesome(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
  9. {
  10. int i;
  11.  
  12. for(i=0; i<10; i++)
  13. printf("Steve is awesome %i\n",i);
  14.  
  15. return TCL_OK;
  16.  
  17. }
  18.  
  19. int Awesome_Init(Tcl_Interp *interp)
  20. {
  21.  
  22. if( NULL == Tcl_InitStubs(interp, TCL_VERSION, 0) )
  23. return TCL_ERROR;
  24.  
  25. Tcl_CreateObjCommand(interp, "awesome", be_awesome, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  26. return TCL_OK;
  27.  
  28. }
  29. -----
  30.  
  31.  
  32. And here is the makefile:
  33.  
  34. -----
  35. all:
  36. gcc -shared -ltclstub8.4 -I/usr/include/tcl8.4 -o awesome.so awesome.c
  37.  
  38. clean:
  39. rm -f *~ *.o
  40. -----
  41.