Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.tcl

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 08-16-2012, 01:14 AM
Michael Soyka
Guest
 
Posts: n/a
Default Question: What does a Starpacked application do with stdout?

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
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 08-16-2012, 02:55 AM
Robert Heller
Guest
 
Posts: n/a
Default Re: Question: What does a Starpacked application do with stdout?

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



Reply With Quote
  #3 (permalink)  
Old 08-16-2012, 11:05 AM
Michael Soyka
Guest
 
Posts: n/a
Default Re: Question: What does a Starpacked application do with stdout?

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!

Reply With Quote
  #4 (permalink)  
Old 08-16-2012, 02:23 PM
Arjen Markus
Guest
 
Posts: n/a
Default Re: Question: What does a Starpacked application do with stdout?

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
Reply With Quote
  #5 (permalink)  
Old 08-16-2012, 02:47 PM
Robert Heller
Guest
 
Posts: n/a
Default Re: Question: What does a Starpacked application do with stdout?

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



Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 03:21 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.