From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6391 invoked by alias); 8 Apr 2003 16:14:28 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 6362 invoked from network); 8 Apr 2003 16:14:28 -0000 Received: from unknown (HELO main.gmane.org) (80.91.224.249) by sources.redhat.com with SMTP; 8 Apr 2003 16:14:28 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 192vj2-0001ni-00 for ; Tue, 08 Apr 2003 18:13:32 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: cygwin@cygwin.com Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 192viV-0001k3-00 for ; Tue, 08 Apr 2003 18:12:59 +0200 From: "BB" Subject: Re: Bug in GUI App WinMain Arguments Date: Tue, 08 Apr 2003 16:43:00 -0000 Message-ID: References: <01c101c2fae4$daae51e0$5300a8c0@pomello> <20030405151952.GA276@world-gov> Reply-To: "BB" X-Complaints-To: usenet@main.gmane.org X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-SW-Source: 2003-04/txt/msg00700.txt.bz2 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" 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(@9VQPE=I;DUA:6Y#4E13=&%R='5P0V%L;&5D M(#T@(DYO(CL*"B-I9F1E9B!?7WA#64=724Y?7PI7:6Y-86EN0U)44W1A"YC8E-I>F4@/2!S:7IE;V8H=V-E>"D["@EW8V5X+G-T>6QE(#T@0U-? M2%)%1%)!5R!\($-37U92141205<["@EW8V5X+FQP9FY7;F10'1R82 ](# ["@EW8V5X+F-B5VYD17AT"YH26YS=&%N8V4@/2!H26YS=&%N8V4["@EW8V5X+FA)8V]N M(#T@3&]A9$EC;VXH3E5,3"P@241)7T%04$Q)0T%424].*3L*"7=C97@N:$-U MDUE;G5.86UE(#T@3E5,3#L*"7=C97@N;'!S>D-L87-S3F%M92 ](")( M14Q,3R(["@EW8V5X+FA)8V]N4VT@/2!.54Q,.PH*"6EF("@A4F5G:7-T97)# M;&%S