X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Message-ID: <492AF8F1.872411D4@dessent.net>
Date: Mon, 24 Nov 2008 10:56:49 -0800
From: Brian Dessent <brian@dessent.net>
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: [OT] Re: Opening a (cygwin-ised) DLL
References: <003a01c94e17$0d87fcc0$4001a8c0@mycomputer> <492AA69C.2030806@byu.net> <001401c94e3d$18093d00$4001a8c0@mycomputer> <003601c94e3f$39a6aae0$4001a8c0@mycomputer> <492AE38C.4060201@users.sourceforge.net>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Reply-To: cygwin@cygwin.com
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

"Yaakov (Cygwin Ports)" wrote:

> John Emmas wrote:
> > Oops, I meant to ask another question (almost a variation on the same
> > theme).  Does Cygwin itself (or more correctly, its linker) link
> > automatically to any of the standard Windows libs (such as kernel32.lib,
> > user32.lib etc).
> 
> kernel32 is added by default because libcygwin.a depends on it.  If you
> pass -mwindows to gcc during linking, then gdi32 is added as well.

It's not only kernel32:

$ gcc -dumpspecs | egrep -A2 '\*lib:'
*lib:
  %{pg:-lgmon}   %{!mno-cygwin:-lcygwin}  
%{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32}   %{mwindows:-lgdi32
-lcomdlg32}   -luser32 -lkernel32 -ladvapi32 -lshell32

This means that by default -luser32 -lkernel32 -ladvapi32 -lshell32 are
added to every link, as well as -lgdi32 -lcomdlg32 if using -mwindows.

Brian

--
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/

