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 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
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_DStringInit(&dstPtr);
   Tcl_WinTCharToUtf(sScript, strlen(sScript), &dstPtr);
   Tcl_Eval(pInterp, dstPtr.string);
   Tcl_DStringFree(&dstPtr);
   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);
   Tcl_DeleteInterp(m_pInterp);
   return 0;
}

Regards,
Roman

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

Regards,
Roman

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 http://tmml.sourceforge.net/doc/tcl/index.html and in John Ousterhout's book http://www.wellho.net/book/0-201-63337-X.html and in Brent Welch's book http://www.wellho.net/book/0-13-022028-0.html 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.

Regards,
Roman

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.

Regards,
Roman V. Gavrilov

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

Graham



This page is a thread posted to the opentalk forum at www.opentalk.org.uk 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., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho