Re: C Interface question. RE: 8.0 vs 8.4
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: C Interface question. RE: 8.0 vs 8.4

From: Michael Schlenker <schlenk@uni-oldenburg.de>
Date: Sun Apr 16 2006 - 23:50:04 CEST

bbailey@raytheon.com schrieb:
>
> Hello All,
>
> I am currently working to re-work a C app with a Tcl/Tk UI. It had been
> built on Tcl/Tk 8.0 and I intend to use 8.4.12. My problem comes when I
> attempt to execute the compiled C app. When built and run under 8.0, it
> works fine. However, I get an error in the function Tcl_Init when built
> and run under 8.4.12.
>
> I use the standard Windows Tcl/Tk install programs in both cases. In
> order to isolate the problem, I stripped all the code but the init
> routines and supplied a simple script to invoke. I compile the code as
> follows (MS VS 2003):
>
> For 8.4.12:
>
> cl test.cpp /Ic:\win32app\tcl\include libc.lib kernel32.lib user32.lib
> wsock32.lib advapi32.lib mpr.lib winspool.lib netapi32.lib
> c:\win32app\tcl\lib\tk84.lib c:\win32app\tcl\lib\tcl84.lib
> /NODEFAULTLIB:library
>
> For 8.0:
>
> cl test.cpp /Ic:\win32app\tcl\include libc.lib kernel32.lib user32.lib
> wsock32.lib advapi32.lib mpr.lib winspool.lib netapi32.lib
> c:\win32app\tcl\lib\tk80vc.lib c:\win32app\tcl\lib\tcl80vc.lib
> /NODEFAULTLIB:library
>
> The simple code itself:
>
> _______________________________________________
>
> #include <stdio.h>
> #include <tk.h>
> #include <tcl.h>
>
>
> int main(void) {
>
> Tcl_Interp *interp;
>
>
> interp = Tcl_CreateInterp();
>
>
> if (Tcl_Init(interp) == TCL_ERROR) {
> printf("Error initing Tcl");
> return TCL_ERROR;
> }
>
> if ((Tk_Init(interp) == TCL_ERROR)) {
> printf("Error initing Tk");
> return TCL_ERROR;
> }
>
>
> if (Tcl_EvalFile (interp, "c:\\ben\\test\\test\\test.tcl"))
> {
> fprintf(stderr, "Error in script (%s):%s\n",
> "c:\\ben\\test\\test\\test.tcl", interp->result);
> return(1);
> }
>
>
> /* Invoke the Tk objects */
> Tk_MainLoop();
> Tcl_DeleteInterp(interp);
> return TCL_OK;
> }
>
> ________________________________________________________
>
> Any insight would be greatly appreciated.
>
> Ben

Probably your missing at least a call to Tcl_FindExecutable() the interp
initialization has changed quite a bit between 8.0 and 8.4.

Michael
Received on Sun Apr 30 03:13:29 2006