I have a very simple application. The printf in myProc produces no results if i run it on Linux. On Solaris 7 it prints the message "this isn't a Tk application".
Why?
Compilation and linking:
gcc -o mytk.run mytk.c -L/usr/openwin/lib -ltcl -ltk -lX11 -ldl -lm -lpthread
Tcl8.3.3\Tk8.3.3
gcc3.0.3
Thanks in advance.
#include <stdio.h>
#include <tcl.h>
#include <tk.h>
#include <pthread.h>
void *myProc(void *interp)
{
Tcl_Interp *i = (Tcl_Interp *)interp;
Tk_MainWindow(i);
printf("result: %s\n", i->result);
}
int main(int argc, char** argv)
{
Tk_Window mainWindow;
Tcl_Interp *interp;
interp = Tcl_CreateInterp();
Tcl_Init(interp);
Tk_Init(interp);
mainWindow = Tk_MainWindow(interp);
Tcl_Eval(interp, "button .b -text \"Hi\" -command exit"
Tcl_Eval(interp, "pack .b"
pthread_t *thr = (pthread_t*) malloc(sizeof(pthread_t));
pthread_create(thr, 0, &myProc, (void *) interp);
Tk_MainLoop();
exit(1);
}
Why?
Compilation and linking:
gcc -o mytk.run mytk.c -L/usr/openwin/lib -ltcl -ltk -lX11 -ldl -lm -lpthread
Tcl8.3.3\Tk8.3.3
gcc3.0.3
Thanks in advance.
#include <stdio.h>
#include <tcl.h>
#include <tk.h>
#include <pthread.h>
void *myProc(void *interp)
{
Tcl_Interp *i = (Tcl_Interp *)interp;
Tk_MainWindow(i);
printf("result: %s\n", i->result);
}
int main(int argc, char** argv)
{
Tk_Window mainWindow;
Tcl_Interp *interp;
interp = Tcl_CreateInterp();
Tcl_Init(interp);
Tk_Init(interp);
mainWindow = Tk_MainWindow(interp);
Tcl_Eval(interp, "button .b -text \"Hi\" -command exit"
Tcl_Eval(interp, "pack .b"
pthread_t *thr = (pthread_t*) malloc(sizeof(pthread_t));
pthread_create(thr, 0, &myProc, (void *) interp);
Tk_MainLoop();
exit(1);
}