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
 
This week, we're updating our course layouts and descriptions. Presentation and materials always gently change over time, but just occasionally there's a need to make a step change to clear out some of the old and roll in the new. That's now happening - but over a long and complex site it's not instant and you'll see sections of the site changing up to and including 19th September.

See also [here] for status update
 
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., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho