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/Tl initialization in Windows

Posted by tclfan (tclfan), 24 March 2004
Please help me with this problem, I'll be extremely grateful !

I have to use Tcl/Tk from C code, and I do it in this way :

#include <tcl.h>
#include <tk.h>

int main(int argc, char* argv[])
 Tcl_Interp*  pInt;


 <here I submit some my command to pInt>


The problem is that in Windows Tcl_Init returns TCL_ERROR (and nothing works), but if I skip a call to Tcl_Init, later calls fail. Though this code works fine in Solaris.

Can anybody tell me what am I doing wrong ? or what should I do ?
I use Tcl/Tck 8.4.6, self compliled as well as ActiveTcl binary release for Win.
They both fail.

Posted by admin (Graham Ellis), 25 March 2004
I wonder if you're using the same compiler for your Tcl application that was used for the Tcl libraries.   If the libraries were compiled with (say) 16 bit integers and the your code - including crutially the .h files - with 32 bit integers, you'll be in all sorts of trouble.

Posted by tclfan (tclfan), 29 March 2004
 Thank you for your posting !

I use the same compiler, but I'm not shure all project settings that came to me in makefile with Tcl sources are the same to settings I use in my project. Unfortunatelly, I have no time to examine all of the numerous MVSC settings, used there, so I cannot guarantee project settings are completely the same.

But I've noticed an interesting thing. Though the sample I've described doesn't work, the way when I generate Tcl script and then pass it into Tk_Main, works fine ! That's why I asked do I start Tcl properly, thinking I don't make somethihg that Tk_Main does.
I've traced into Tcl sources trying to find the difference, but found out that the problem takes more time I can afford.

But its nevermind, the way through Tk_Main is acceptable for my task, so I'll use it.

Thank you for resplonce !

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