Ns TclInitInterps()

From AOLserver Wiki
Jump to navigation Jump to search

Ns_TclInitInterps()

Generally called during module initialisation (see Ns_ModuleInit()):

int Ns_ModuleInit(char *hServer, char *hModule)
{

    return (Ns_TclInitInterps(hServer, MyInterpInitFuncName, NULL));

}

static int MyInterpInitFuncName(Tcl_Interp *interp, void *context)
{
    Tcl_CreateCommand(interp, "ns_myfuncname", MyFuncNameCmd, NULL, NULL);

    return NS_OK;
}

static int MyFuncNameCmd(ClientData context, Tcl_Interp *interp, int argc, char **argv)
{

    Tcl_AppendResult(interp, "MyFuncResultData", NULL);

    return NS_OK;
}