Bug in GUI App WinMain Arguments

BB canofspam@att.net
Tue Apr 8 16:43:00 GMT 2003


I have attached a GUI Win32 app.

It builds without either of the options (WinMainCRTStartup() or -e
mainCRTStartup) specified in the users guide.  I think the default
implementation of main() in calls WinMain(), so I wonder if the call to
mainCRTStartup is required.  Perhaps the FAQ is out of date.

If built with "-e WinMainCRTStartup" to set the entry point,
WinMainCRTStartup
gets called.

BB.

Running hello.exe
"Joshua Daniel Franklin" <joshuadfranklin@yahoo.com> wrote in message
news:20030405151952.GA276@world-gov...
> On Fri, Apr 04, 2003 at 07:58:27PM +0100, Max Bowsher wrote:
> > BB wrote:
> > > Also, according to the "Cygwin Users Guide", I have included the
following
> > > line in the code.
> > > WinMainCRTStartup() { mainCRTStartup(); }
> > > It doesnt seem to be called.  Is the User Guide correct? The same
problem
> > > occurs if I omit the line and use the "-e _mainCRTStartup" as
suggested in
> > > the User Guide.
> >
> > This sounds like out-of-date info to me (but that's just a guess).
>
> OK, I'd like to make sure this is up-to-date, but I've never built a
> GUI Win32 application in Cygwin (well, except setup.exe). Can someone
> post a "helloworld-gui" example or something? Or, here's what the User's
> Guide currently says, please reply with inaccuracies:
>
> GUI Mode Applications
>
> Cygwin allows you to build programs with full access to the standard
Windows 32-bit API, including the GUI functions as defined in any Microsoft
or off-the-shelf publication. However, the process of building those
applications is slightly different, as you'll be using the GNU tools instead
of the Microsoft tools.
>
> For the most part, your sources won't need to change at all. However, you
should remove all __export attributes from functions and replace them like
this:
>
> int foo (int) __attribute__ ((__dllexport__));
>
> int
> foo (int i)
>
> For most cases, you can just remove the __export and leave it at that. For
convenience sake, you might want to include the following code snippet when
compiling GUI programs. If you don't, you will want to add "-e
_mainCRTStartup" to your link line in your Makefile.
>
> #ifdef __CYGWIN__
> WinMainCRTStartup() { mainCRTStartup(); }
> #endif
>
> The Makefile is similar to any other UNIX-like Makefile, and like any
other Cygwin makefile. The only difference is that you use gcc -mwindows to
link your program into a GUI application instead of a command-line
application. Here's an example:
>
> myapp.exe : myapp.o myapp.res
> gcc -mwindows myapp.o myapp.res -o $@
>
> myapp.res : myapp.rc resource.h
> windres $< -O coff -o $@
>
> Note the use of windres to compile the Windows resources into a
COFF-format .res file. That will include all the bitmaps, icons, and other
resources you need, into one handy object file. Normally, if you omitted the
"-O coff" it would create a Windows .res format file, but we can only link
COFF objects. So, we tell windres to produce a COFF object, but for
compatibility with the many examples that assume your linker can handle
Windows resource files directly, we maintain the .res naming convention. For
more information on windres, consult the Binutils manual.
>




begin 666 hello.c
M+RHM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M*B\*+RH@:&5L;&\N8R M(&=U:2!H96QL;R!W;W)L9" @(" @(" @(" @(" @
M(" @*B\*+RH@8G5I;&0Z(&=C8R M;7=I;F1O=W,@:&5L;&\N8R M;R!H96QL
M;RYE>&4@*B\*+RHM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM*B\*(VEN8VQU9&4@/'=I;F1O=W,N:#X*"F-H87(@9VQP<WI4
M97AT6S$P,C1=.PI,4%-44B!G;'!S>E=I;DUA:6Y#4E13=&%R='5P0V%L;&5D
M(#T@(DYO(CL*"B-I9F1E9B!?7WA#64=724Y?7PI7:6Y-86EN0U)44W1A<G1U
M<"@I"GL*"6=L<'-Z5VEN36%I;D-25%-T87)T=7!#86QL960@/2 B665S(CL*
M"6UA:6Y#4E13=&%R='5P*"D["GT*(V5N9&EF"@I,4D5354Q4($-!3$Q"04-+
M(%=N9%!R;V,H2%=.1"P@54E.5"P@5U!!4D%-+"!,4$%204TI.PH*:6YT($%0
M245.5%)9(%=I;DUA:6XH2$E.4U1!3D-%(&A);G-T86YC92P@"@D)2$E.4U1!
M3D-%(&A0<F5V26YS=&%N8V4L"@D)3%!35%(@;'!#;61,:6YE+ H)"6EN="!N
M0VUD4VAO=RD*>PH)<W!R:6YT9BAG;'!S>E1E>'0L( H)"2)(96QL;R!7;W)L
M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0ER971U<FX@1D%,4T4[
M"@H)4VAO=U=I;F1O=RAH5VYD+"!N0VUD4VAO=RD["@E5<&1A=&57:6YD;W<H
M:%=N9"D["@H)35-'(&US9SL*"7=H:6QE("A'971-97-S86=E*"9M<V<L($Y5
M3$PL(# L(# I*2 *"7L*"0E4<F%N<VQA=&5-97-S86=E*"9M<V<I.PH)"41I
M<W!A=&-H365S<V%G92@F;7-G*3L*"7T*"@ER971U<FX@;7-G+G=087)A;3L*
M?0H*3%)%4U5,5"!#04Q,0D%#2R!7;F10<F]C*$A73D0@:%=N9"P@54E.5"!M
M97-S86=E+"!74$%204T@=U!A<F%M+"!,4$%204T@;%!A<F%M*0I["@E004E.
M5%-44E5#5"!P<SL*"4A$0R!H9&,["@D*"7-W:71C:" H;65S<V%G92D@"@E[
M"@D)8V%S92!735]004E.5#H*"0D):&1C(#T@0F5G:6Y086EN="AH5VYD+" F
M<',I.PH)"0E214-4(')T.PH)"0E'971#;&EE;G1296-T*&A7;F0L("9R="D[
M"@D)"41R87=497AT*&AD8RP@9VQP<WI497AT+"!S=')L96XH9VQP<WI497AT
M*2P@)G)T+"!$5%]43U @?"!$5%],1494*3L*"0D)16YD4&%I;G0H:%=N9"P@
M)G!S*3L*"0D)8G)E86L["@D)8V%S92!735]$15-44D]9.@H)"0E0;W-T475I
M=$UE<W-A9V4H,"D["@D)"6)R96%K.PH)"61E9F%U;'0Z"@D)"7)E='5R;B!$
M9697:6YD;W=0<F]C*&A7;F0L(&UE<W-A9V4L('=087)A;2P@;%!A<F%M*3L*
1"7T*"7)E='5R;B P.PI]"@H`
`
end



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list