Attachment "TclEmbedEx.cpp" to
ticket [467505ffff]
added by
deech
2001-10-03 21:40:38.
// TclEmbedEx.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "tcl.h"
#include <windows.h>
#include <iostream.h>
int main(int argc, char* argv[])
{
char* test;
int r;
Tcl_FindExecutable(argv[0]);
Tcl_Interp * g_interp = Tcl_CreateInterp();
// For this to work you must have TCL_LIBRARY environment set
// to the location of your TCL installation!
//--------------------------------------------
r = Tcl_Init(g_interp);
test = Tcl_ErrnoMsg(Tcl_GetErrno());
//VALUE OF auto_path works fine
//------------------------------
r = Tcl_Eval(g_interp, "puts $auto_path");
if (r != TCL_OK){
cout << "------" << endl;
cout << Tcl_ErrnoMsg(Tcl_GetErrno()) << endl;
cout << Tcl_GetStringResult(g_interp) << endl;
cout << endl;
}
//VALUE OF tcl_libPath works fine
//---------------------------------
r = Tcl_Eval(g_interp, "puts $tcl_libPath");
if (r != TCL_OK){
cout << "------" << endl;
cout << Tcl_ErrnoMsg(Tcl_GetErrno()) << endl;
cout << Tcl_GetStringResult(g_interp) << endl;
cout << endl;
}
// VALUE OF tcl_library works fine
//---------------------------------
r = Tcl_Eval(g_interp, "puts $tcl_library");
if (r != TCL_OK){
cout << "------" << endl;
cout << Tcl_ErrnoMsg(Tcl_GetErrno()) << endl;
cout << Tcl_GetStringResult(g_interp) << endl;
cout << endl;
}
//PROBLEMS START HERE - all of these seem to crash the interpreter!!!
//-----------------------
//r = Tcl_Eval(g_interp, "puts [info nameofexecutable]");
r = Tcl_Eval(g_interp, "puts [info patchlevel]");
if (r != TCL_OK){
cout << "------" << endl;
cout << Tcl_ErrnoMsg(Tcl_GetErrno()) << endl;
cout << Tcl_GetStringResult(g_interp) << endl;
cout << endl;
}
return r;
}