|
|||
|
Hello all,
I have a pure Tcl application that I've put in a Windows Starpack for distribution to others. The app has a number of "puts" calls that write to stdout (Tk is not used). When the app is run from within a DOS command window using tclsh, the outputs are seen in the window as one would expect. If I run the same code as a Starpacked app and run it in a command window, the app runs noticeably slower with very high CPU utilization and no outputs ever appear before the app exits (I assume normally). Interestingly, if I redirect stdout on the command line to a disk file, the Starpacked app runs quickly, as it should, and the outputs go into the disk file as one would expect. Can anyone explain this behavior? Thanks in advance, Mike |
|
|
||||
|
||||
|
|
|
|||
|
At Wed, 15 Aug 2012 21:14:56 -0400 Michael Soyka <mssr953@gmail.com> wrote:
> > Hello all, > > I have a pure Tcl application that I've put in a Windows Starpack for > distribution to others. The app has a number of "puts" calls that write > to stdout (Tk is not used). > > When the app is run from within a DOS command window using tclsh, the > outputs are seen in the window as one would expect. If I run the same > code as a Starpacked app and run it in a command window, the app runs > noticeably slower with very high CPU utilization and no outputs ever > appear before the app exits (I assume normally). Interestingly, if I > redirect stdout on the command line to a disk file, the Starpacked app > runs quickly, as it should, and the outputs go into the disk file as one > would expect. > > Can anyone explain this behavior? It is a 'Windows Stupidity'. MS-Windows has two flavors of 'crt0' (the little function that calls C's main() function). One for CLI (eg 'DOSish') programs and one for GUI (eg 'Windowsish') programs. I believe the bare tclsh.exe is linked with the DOS-flavored crt0, wish.exe with the Windows-flavored crt0 and the stock tclkit is also linked with the Windows-flavored. I believe there is a tclshkit.exe out there that is DOS-flavored -- it sounds like you should be using this for the -runtime option for your CLI app. The DOS-flavored crt0 behaves much like the UNIX crt0 function. The Windows-flavored crt0 does what is needful for a GUI application (does the magic to connect to the GUI sub-system, where stdin, stdout, and stderr don't really exist in the MS-Windows world, at least in the sense they do under UNIX (including UNIX GUI applications). > > Thanks in advance, > > Mike > -- Robert Heller -- 978-544-6933 / heller@deepsoft.com Deepwoods Software -- http://www.deepsoft.com/ () ascii ribbon campaign -- against html e-mail /\ www.asciiribbon.org -- against proprietary attachments |
|
|||
|
On 8/15/2012 10:55 PM, Robert Heller wrote:
> At Wed, 15 Aug 2012 21:14:56 -0400 Michael Soyka <mssr953@gmail.com> wrote: > >> >> Hello all, >> >> I have a pure Tcl application that I've put in a Windows Starpack for >> distribution to others. The app has a number of "puts" calls that write >> to stdout (Tk is not used). >> >> When the app is run from within a DOS command window using tclsh, the >> outputs are seen in the window as one would expect. If I run the same >> code as a Starpacked app and run it in a command window, the app runs >> noticeably slower with very high CPU utilization and no outputs ever >> appear before the app exits (I assume normally). Interestingly, if I >> redirect stdout on the command line to a disk file, the Starpacked app >> runs quickly, as it should, and the outputs go into the disk file as one >> would expect. >> >> Can anyone explain this behavior? > > It is a 'Windows Stupidity'. MS-Windows has two flavors of 'crt0' (the > little function that calls C's main() function). One for CLI (eg > 'DOSish') programs and one for GUI (eg 'Windowsish') programs. > > I believe the bare tclsh.exe is linked with the DOS-flavored crt0, > wish.exe with the Windows-flavored crt0 and the stock tclkit is also > linked with the Windows-flavored. I believe there is a tclshkit.exe out > there that is DOS-flavored -- it sounds like you should be using this > for the -runtime option for your CLI app. The DOS-flavored crt0 behaves > much like the UNIX crt0 function. The Windows-flavored crt0 does what > is needful for a GUI application (does the magic to connect to the GUI > sub-system, where stdin, stdout, and stderr don't really exist in the > MS-Windows world, at least in the sense they do under UNIX (including > UNIX GUI applications). > >> >> Thanks in advance, >> >> Mike >> > Thanks for the explanation. It took me several hours of head-scratching before I tried redirection and the light bulb turned on! My little app is slightly more than just a throwaway but not by much. I had chosen Tcl because of its wonderful regular expression support and the availability of Starpacks. I had hoped to avoid putting the outputs in a text widget with buttons for saving the contents out of sheer laziness. Now I'll have to do the right thing! |
|
|||
|
Op donderdag 16 augustus 2012 13:05:08 UTC+2 schreef Michael Soyka het volgende:
> > My little app is slightly more than just a throwaway but not by much. I > > had chosen Tcl because of its wonderful regular expression support and > > the availability of Starpacks. I had hoped to avoid putting the outputs > > in a text widget with buttons for saving the contents out of sheer > > laziness. Now I'll have to do the right thing! No, Robert is right: there is a tclkitsh.exe that makes your starpack behave in much the same way as with tclsh. Just replace "tclkit.exe" by "tclkitsh.exe" when you create the starpack. Regards, Arjen |
|
|||
|
At Thu, 16 Aug 2012 07:05:08 -0400 Michael Soyka <mssr953@gmail.com> wrote:
> > On 8/15/2012 10:55 PM, Robert Heller wrote: > > At Wed, 15 Aug 2012 21:14:56 -0400 Michael Soyka <mssr953@gmail.com> wrote: > > > >> > >> Hello all, > >> > >> I have a pure Tcl application that I've put in a Windows Starpack for > >> distribution to others. The app has a number of "puts" calls that write > >> to stdout (Tk is not used). > >> > >> When the app is run from within a DOS command window using tclsh, the > >> outputs are seen in the window as one would expect. If I run the same > >> code as a Starpacked app and run it in a command window, the app runs > >> noticeably slower with very high CPU utilization and no outputs ever > >> appear before the app exits (I assume normally). Interestingly, if I > >> redirect stdout on the command line to a disk file, the Starpacked app > >> runs quickly, as it should, and the outputs go into the disk file as one > >> would expect. > >> > >> Can anyone explain this behavior? > > > > It is a 'Windows Stupidity'. MS-Windows has two flavors of 'crt0' (the > > little function that calls C's main() function). One for CLI (eg > > 'DOSish') programs and one for GUI (eg 'Windowsish') programs. > > > > I believe the bare tclsh.exe is linked with the DOS-flavored crt0, > > wish.exe with the Windows-flavored crt0 and the stock tclkit is also > > linked with the Windows-flavored. I believe there is a tclshkit.exe out > > there that is DOS-flavored -- it sounds like you should be using this > > for the -runtime option for your CLI app. The DOS-flavored crt0 behaves > > much like the UNIX crt0 function. The Windows-flavored crt0 does what > > is needful for a GUI application (does the magic to connect to the GUI > > sub-system, where stdin, stdout, and stderr don't really exist in the > > MS-Windows world, at least in the sense they do under UNIX (including > > UNIX GUI applications). > > > >> > >> Thanks in advance, > >> > >> Mike > >> > > > Thanks for the explanation. It took me several hours of head-scratching > before I tried redirection and the light bulb turned on! > > My little app is slightly more than just a throwaway but not by much. I > had chosen Tcl because of its wonderful regular expression support and > the availability of Starpacks. I had hoped to avoid putting the outputs > in a text widget with buttons for saving the contents out of sheer > laziness. Now I'll have to do the right thing! If it really isn't a true GUI application, the use of the tclshkit.exe is the correct solution. Building a GUI just to save plain text output is overkill (I know, it is the 'MS-Windows' way, where the use of a CLI is to be avoided at all costs). > > -- Robert Heller -- 978-544-6933 / heller@deepsoft.com Deepwoods Software -- http://www.deepsoft.com/ () ascii ribbon campaign -- against html e-mail /\ www.asciiribbon.org -- against proprietary attachments |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|