[tcljava-user] Unable to link Tcl variable, badly need help!
Brought to you by:
mdejong
From: Eduard P. <edu...@ru...> - 2008-11-03 20:05:47
|
Hello, I have created a new Tcl command, which starts Tftp server from loaded DLL, and I am trying to link variables between C and Tcl, which supposed to count received blocks. I start the command in a separate Tcl thread in order to receive the prompt back. Everything works but Tcl variable never changes its value. //Dll Staff extern int RcvBlocks; EXTERN_C int DECLSPEC_EXPORT Tftpsrvdll_Init ( Tcl_Interp* interp ) { #ifdef USE_TCL_STUBS Tcl_InitStubs(interp, "8.4", 0); #endif //link variables Tcl_LinkVar(interp, "env(rcvBlocks)", (char *)&RcvBlocks, TCL_LINK_INT); //tftps Tcl_CreateCommand( interp, "tftps", (Tcl_CmdProc*) TftpSrv, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); return 0; } //Tcl Staff % set env(rcvBlocks) 0 0 % package require Thread 2.6.3 % thread::create { load TftpSrvDLL.dll tftps -v } tid00000E70 TFTP Server MultiThreaded Version 1.53 Windows Built 1530 accepting requests.. % #enter key % puts env(rcvBlocks) 0 % % puts env(rcvBlocks) 0 % % Client 192.168.10.152:2269 C:\Tcl\bin\DownloadFile.bin, 4201 Blocks Served % #enter key % puts env(rcvBlocks) 0 % In addinion I can not get prompt immediately, but have to hit enter each time. Am I missing something? Thanks in advance, Ed |