delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/08/22/11:28:03

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 22 Aug 2008 11:19:16 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin compiler and linker options
Message-ID: <20080822151916.GB13113@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4126b3450808220352y12a25fddi444e3df3e1cb590a AT mail DOT gmail DOT com> <002f01c90456$1f080e50$4001a8c0 AT mycomputer> <5E25AF06EFB9EA4A87C19BC98F5C8753014F88E0 AT core-email DOT int DOT ascribe DOT com>
MIME-Version: 1.0
In-Reply-To: <5E25AF06EFB9EA4A87C19BC98F5C8753014F88E0@core-email.int.ascribe.com>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Fri, Aug 22, 2008 at 03:52:35PM +0100, Phil Betts wrote:
>John Emmas wrote on Friday, August 22, 2008 1:54 PM::
>
>> Just doing some searches on the internet, there seems to be an awful
>> lot of misinformation / misunderstanding about what the various
>> Cygwin-gcc compiler and linker flags do.
>> 
>> For example, I saw one article that said that that flag -mno-cygwin
>> causes an executable to be generated which does *not* require
>> cygwin1.dll to be present on the host machine.  That doesn't seem to
>> be true (I've tried it).
>
>If you link with cygwin DLLs, it is the DLLs that require cygwin1.dll,
>not the executable.  If you compile with -mno-cygwin, do not link with 
>any cygwin DLLs.  You wouldn't link with a cygwin DLL if you were
>cross-compiling for Linux; the -mno-cygwin is essentially specifying
>a cross-compilation for a cygwin-free architecture.
>
>Think of it like this:
>  gcc -mvegan spaghetti.c -o meal -lparmesan
>will not give you a vegan meal.
>
>
>$ cat >hw.c <<'EOF'
>> #include <stdio.h>
>> 
>> int main (int argc, char **argv)
>> {
>>     puts ("Hello World");
>>     return 0;
>> }
>> EOF
>$ gcc -mno-cygwin hw.c -o hw.exe
>$ cygcheck ./hw.exe
>.\hw.exe
>  C:\WINDOWS\system32\msvcrt.dll
>    C:\WINDOWS\system32\KERNEL32.dll
>      C:\WINDOWS\system32\ntdll.dll
>$ ./hw.exe
>Hello World
>$ 
>
>I see no trace of cygwin1.dll in the cygcheck output.
>
>
>> I saw another article which said that if you
>> don't use the flag -mwindows, a DOS terminal will open every time you
>> launch your app.  That doesn't seem to be true either (at least, not
>> on my machine). 
>
>How are you launching it?  If you're doing it from a prompt, there's no
>need to open another window.  If you double-click on it in an Explorer
>window, you WILL get a DOS box unless you specified -mwindows.  Try the
>above example and double click on it.  You'll get a DOS box flash up
>momentarily.  Recompile using -mwindows, and you won't.
>
>> Is there any resource available where I can find out some
>> (authoritative) information about what the various flags actually do?
>
>From the examples you've given, it seems you've already found some
>authoritative information, but instead of doubting your ability to
>comprehend, you've chosen to doubt the words of others and criticize 
>them in a public forum without providing any evidence to back up your
>assertions.  Not only is that arrogant, but now YOUR misinformation /
>misunderstanding is out there to cause confusion for others.
>
>It would be nice if the cygwin-specific options were documented in the 
>gcc info file, but they don't appear to be.  Don't expect -mno-cygwin
>to appear there soon either, because my understanding is that the
>-mno-cygwin option will be removed soon because of the surprising 
>number of people who can't seem to grasp the concept of no-cygwin.

Phil is 100% correct here.  It's heartening to see someone so thoroughly
getting it after having to so frequently deal with the misconceptions
about -mno-cygwin.  Confusion about -mwindows is new though.

I'm counting the days until -mno-cygwin disappears.  It is a blight that
must be expunged.  I know that as soon as it is gone there will be a
general wail from people who use it but it really should never have been
implemented.
--
Christopher Faylor			spammer? ->	aaaspam AT sourceware DOT org
Cygwin Co-Project Leader
Netapp, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019