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
Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems
Access violation with Tcl_EvalFIle

Posted by jane (jane), 19 April 2005
Hi all,
I am not sure whether this is the right place to post this. If this post fits here, please help me. If I this is not the place, please point me to the right place.

I am very new to Tcl programming world.
I am trying to implement a TCL command in C.
Before that I wanted to try out a small experiment given in a book. But I am  getting an access violation(system error) when I invoke Tcl_EvalFile. If I use Tcl_Eval with same command, then it works just fine. Somebody please hel
p me.
This is on Windows XP platform.

Thanks a lot in advance.

This is the code:

int main()
Tcl_Interp *myInterp;
int retCode;
char name[] = "./simple.tcl";

myInterp = Tcl_CreateInterp();

retCode = Tcl_EvalFile(myInterp, name); // Access Violation
if(retCode != TCL_OK)
fprintf(stdout, "Error\n");

return 1;

contents of simple.c are : puts Hello.

- Jane

Posted by admin (Graham Ellis), 20 April 2005
I can't spot anything straight away (but it just might be staring me in the face!).  The best I can suggest is try the examples that we'ver got at which are pretty similar; if they work, then you can play "spot the difference" and if not then I can have a further look.  Also - do you have access to a "nix" operating system to test / see if your code works there.   A further thought - which C compiler are you using on the Microsoft system, and were the Tcl libraries compiled under the SAME compiler?  If not, that's a possible compatabilty issue.

Posted by jane (jane), 20 April 2005
Thanks for the reply, Graham. I figured out what the problem was. I called Tcl_FindExecutable before calling Tcl_EvalFile and it works now. Thanks once again for your time

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., 2018: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: • WEB: • SKYPE: wellho