From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7478 invoked by alias); 5 Apr 2003 15:18:17 -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 7471 invoked from network); 5 Apr 2003 15:18:16 -0000 Received: from unknown (HELO ns1.iocc.com) (12.41.224.37) by sources.redhat.com with SMTP; 5 Apr 2003 15:18:16 -0000 Received: from iocc.com (joshua.iocc.com [12.41.227.253]) by ns1.iocc.com (8.11.6/8.11.6) with SMTP id h35FIIE18352 for ; Sat, 5 Apr 2003 09:18:18 -0600 Received: by iocc.com (sSMTP sendmail emulation); Sat, 5 Apr 2003 09:19:52 -0600 Date: Sat, 05 Apr 2003 16:52:00 -0000 From: Joshua Daniel Franklin To: cygwin@cygwin.com Subject: Re: Bug in GUI App WinMain Arguements Message-ID: <20030405151952.GA276@world-gov> References: <01c101c2fae4$daae51e0$5300a8c0@pomello> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01c101c2fae4$daae51e0$5300a8c0@pomello> User-Agent: Mutt/1.4i X-SW-Source: 2003-04/txt/msg00511.txt.bz2 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. -- 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/