Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
Tcl from C (error)

Posted by clavrg (clavrg), 11 January 2004
I have quite simple program, when I want execute a scrip that contains command "source" I recieve "unhandled exception (access violation)" everything works just fine if I execute script as simple as "puts Hello".

Any ideas?

OS: WinXP, Tcl 8.4, MSVC++ 6.0

code snippet:

int ExecuteScript(Tcl_Interp * pInterp, const char * sScript) {
   Tcl_DString dstPtr;
   Tcl_WinTCharToUtf(sScript, strlen(sScript), &dstPtr);
   Tcl_Eval(pInterp, dstPtr.string);
   return 0;

int main(int argc, char* argv[])

   char * script = "source {C:\\my.tcl}; puts Hello";
   /* everything works just fine if I set:
       char * script = "puts Hello";

   m_pInterp = Tcl_CreateInterp();
   ExecuteScript(m_pInterp, script);
   return 0;


Posted by admin (Graham Ellis), 12 January 2004
Looks to me like you might be falling found of file / folder permissions; have you tried sourcing a file that's held in the documents folder of the user as whom you've logged into XP rather than the root folder?

Posted by clavrg (clavrg), 12 January 2004
Does not seem like this is the case, .tcl scrip containing the same text works just fine. I tried to move a file into different folder - outcome is the same


Posted by clavrg (clavrg), 12 January 2004
Update: I figured out that procedure TclpSetInitialEncodings is not being called at all. Therefore all instructions that are related to file-path decoding fail.
Is there anything special I need to call when initialize interpreter (using Tcl_CreateInterp)?

Posted by admin (Graham Ellis), 13 January 2004
I've searched for Tcl_SetInitialEncodings in the documentation at and in John Ousterhout's book and in Brent Welch's book and I've drawn a blank.  Even a Google search gave me nothing ... Can you post up a link to documentation so that I can have a look / see if I can help by putting another mind to it and spotting any clues?

Posted by clavrg (clavrg), 13 January 2004
Link? What link? The only documentation I'm using is a help file that goes with ActiveTcl and Tcl source codes.

I got some respond at comp.lang.tcl. Some dude says that I should call Tcl_FindExecutable... I think I have tried that already - but worth to verify anyway.


Posted by clavrg (clavrg), 13 January 2004
It does work now.
I had couple other problems at different places, that were stopping me from localizing the problem properly.

Roman V. Gavrilov

Posted by admin (Graham Ellis), 14 January 2004
Glad it's working, and thanks for letting us know.


This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2022: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho