Posted to tcl by hat0 at Mon Nov 05 04:20:13 GMT 2007view raw
- Here is awesome.c:
- -----
- #include <stdio.h>
- #include <tcl.h>
- static int be_awesome(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
- {
- int i;
- for(i=0; i<10; i++)
- printf("Steve is awesome %i\n",i);
- return TCL_OK;
- }
- int Awesome_Init(Tcl_Interp *interp)
- {
- if( NULL == Tcl_InitStubs(interp, TCL_VERSION, 0) )
- return TCL_ERROR;
- Tcl_CreateObjCommand(interp, "awesome", be_awesome, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
- return TCL_OK;
- }
- -----
- And here is the makefile:
- -----
- all:
- gcc -shared -ltclstub8.4 -I/usr/include/tcl8.4 -o awesome.so awesome.c
- clean:
- rm -f *~ *.o
- -----