[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FW: tcl tk in windows C++ console app source?



Hello ns-users,

I'm forwarding this posting to you all in the hope that perhaps  someone would like to,
and has a possibility, to pick up the subject of getting nam working under Win9x/NT4.0
using a recent Tcl/Tk (8.0.5 perhaps) distribution's dll libraries instead of the static variants
used by the mash/ns/nam teams. I, a little naively perhaps, got the Tcl/Tk binary release 8.0.5,
and the source code releases also (to get the ``internal'' header files) but the resulting binary
fails with an unexpected page error on tcl80.dll and the error message "xxx tcl_findLibrary".

Perhaps someone with more time and other possibilities and skills might be interested in picking
this subject up?

/ChJ

-----Ursprungligt meddelande-----
Fr�n: John F. Davis <[email protected]>
Diskussionsgrupper: comp.lang.tcl
Datum: den 16 mars 1999 16:17
�mne: Re: tcl tk in windows C++ console app source?


>In article <[email protected]>, 
>[email protected] says...
>> Hello
>> 
>> I need help with a simple c++ console app which embeds tcl/tk.  I pretty 
>> much copied the code from Eric Foster-Johnson Graphics with Tcl&Tk book.
>> However, it doesn't do anything.  I looked at the tkView app and I 
>> noticed he does this on a timer,
>
><snip>
>
>For the archive searchers, here is an app in total simplicty.  
>
>Its just one file.  It uses a script called c:\tmp\foo.tcl by default if
>one isn't given on the command line.  
>
>-------------------------------
>#include <stdio.h>
>#include <stdlib.h>
>#include <tcl.h>
>#include <tk.h>
>
>
>
>int MyInitTclTk(Tcl_Interp *interp) {
>
>
> int status = TCL_OK;
>
>
> status = Tcl_Init(interp);
>
>
> // Report Errors
> if (status != TCL_OK) {
> printf("TCL Error: %d\n", status);
> return TCL_ERROR;
> }
>
> status = Tk_Init(interp);
>
>
> // Report Errors
> if (status != TCL_OK) {
> printf("TK Error: %d\n", status);
> return TCL_ERROR;
> }
>
>
>
> return TCL_OK;
>}
>
>
>
>int main(int argc, char ** argv) {
>
>
>
>    Tcl_Interp *interp;
>    int status = TCL_OK;
>
>
>    printf("Sample Tcl/Tk script eval app.\n");
>
>
> // Create the interpeter.
>    interp = Tcl_CreateInterp();
>
> // Init the interpeter.
> MyInitTclTk(interp);
>
>
>
> // Eval the scrit.  Eval the default one, if none is
> // given on command line.
> char pchBuffer[100];
> printf("argc = %d\n",argc);
> if (argc == 2) {
> sprintf(pchBuffer,"%s",argv[1]);
> } else {
> sprintf(pchBuffer,"c:\\tmp\\foo.tcl");
> }
>    status = Tcl_EvalFile(interp,pchBuffer);
>
>
>
>    // Print result string;
>    if (interp->result != NULL) {
>        printf("TCL: [%s]\n", Tcl_GetStringResult(interp));
>    }
>
>
>    // Report Errors
>    if (status != TCL_OK) {
>        printf("TCL Error: %d\n", status);
>        exit(1);
>    }
>
>
>
> int ok=1;
> Tk_Window tkmain;
> while (ok) {
> Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT);
> tkmain = Tk_MainWindow(interp);
> if (tkmain == NULL) {
> ok = 0;
> }
> }
>
>
>
>    // Free memory for interpeter
>    Tcl_DeleteInterp(interp);
>
>    // Report Errors
>    if (status != TCL_OK) {
>        printf("TCL Error: %d\n", status);
>        exit(1);
>    }
>
>
>
> return 0;
>}
>
>
>
>
>
>
BEGIN:VCARD
VERSION:2.1
N:J�nsson;Christian
FN:Christian J�nsson
EMAIL;PREF;INTERNET:[email protected]
REV:19990318T223024Z
END:VCARD