Hi, for what it worth (and maybe it can help) here's mine:
int Tk_AppInit(Tcl_Interp *interp) {
#ifdef WIN32
wchar_t* tmp = NULL;
#else
char* tmp = NULL;
#endif
size_t nFP_Length;
Tcl_DString ds4Argv;
/*
* Initialize packages
*/
if (Tcl_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
if (Tk_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
/*
this is the place to create the exit handler, I do it like that:
Tcl_CreateExitHandler(dL_exitHandler, x);
where x is a pointer of mine
*/
Tcl_SetSystemEncoding(interp, "utf-8");
/*many other stuff goes here...*/
return TCL_OK;
}
#ifdef WIN32
int wmain(int argc, wchar_t **argv) {
/*
use fflush(NULL) to reset everything in case of crashes
*/
fflush(NULL);
#else
int main (int argc, char* argv[]) {
#endif
int i, noprefs;
for (i = noprefs = 0; i < argc; i++) /* prescan ... */
{
#ifdef WIN32
if (wcscmp(argv[i], L"") && i == 1) {
#else
if (strcmp(argv[i], "") && i == 1) {
#endif
user_prefbuf = user_initloadpreferences_file(argv[i]);
argv[i] = user_prefbuf;
}
else if (i > 0) noprefs = 1;
}
#ifndef __MACOSX_CORE__
TclZipfs_AppHook(&argc, &argv);
#endif
//mainLoop
Tk_Main(argc, argv, Tk_AppInit);
exit(EXIT_SUCCESS);
}