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/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;
 Tcl_CreateInterp(pInt);

 Tcl_Init(pInt);
 Tk_Init(pInt);

 <here I submit some my command to pInt>

 Tk_MainLoop();
 Tcl_DeleteInterp(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 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