delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/04/17/01:09:07

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-ID: <001001c1e5cd$e95b5da0$e4bcfc3e@nori>
From: "Sam Edge" <sam DOT edge AT ntlworld DOT com>
To: <cygwin AT cygwin DOT com>
References: <Pine DOT SOL DOT 4 DOT 44 DOT 0204162043520 DOT 20798-100000 AT argus DOT EECS DOT Berkeley DOT EDU>
Subject: Re: True Static Linking
Date: Wed, 17 Apr 2002 06:07:57 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g3H590H15397

> (1) Is there a "-static" switch that statically links in cygwin1.dll?
> (2) If not, how else can I solve this problem?

I'm fairly new to Cygwin but from what I've picked up there is no static version of the cygwin library available either binary or source. This is a deliberate policy to try to ensure that all running Cygwin processes have the same version loaded and are all using the same shared memory and other kernel objects that are required to simulate the UNIX/POSIX API on top of the Win32 one.

If your program really needs things like fork() or native Berkley sockets you could get the source for Cygwin and patch it to generate your own static version. I've no idea how difficult this might be and maintaining it with newer versions would be a headache. (It may be that a DLL is required by the Win32 architecture for some of the features.)

I doubt whether a simple stand-alone executable needs this.

The first thing to do is to try the "-mno-cygwin" switch on gcc as well as making everything else statically linked. You might get away with this providing you're not relying on Cygwin-specific API calls or C++ standard template libraries. (Make sure you've used SETUP.EXE to install the mingw-runtime and w32api packages first.)

If that's not enough, you can go to http://www.colomsat.net.co/freehost/ngiraldo/cppcygwin.html to add the additional C++ STL. This has instructions for ensuring that you get what you need in a painless manner and can create native Win32 applications with the Cygwin GCC tool chain and all the other nice Cygwin 

(The other approach is to avoid using Cygwin as the development environment and to download the MinGW Win32-native GCC tols and libraries from http://www.mingw.org/, although this shouldn't be needed if you've configued everything correctly in Cygwin.)

MinGW relies on the Micrsoft MSVCRTx.DLL run-time libraries but these are pretty much universal. There is in fact no such thing as completely static linkage under Windows since you always end up dynamically linking to SYSTEM32, USER32, GDI32 and/or other "universal" Win32 system DLLs. The VC runtime are pretty much in this category.

-- 
Sam Edge


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

- Raw text -


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