public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Sam Edge" <sam.edge@ntlworld.com>
To: <cygwin@cygwin.com>
Subject: Re: True Static Linking
Date: Tue, 16 Apr 2002 22:09:00 -0000	[thread overview]
Message-ID: <001001c1e5cd$e95b5da0$e4bcfc3e@nori> (raw)
In-Reply-To: <Pine.SOL.4.44.0204162043520.20798-100000@argus.EECS.Berkeley.EDU>

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

  reply	other threads:[~2002-04-17  5:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-16 21:31 Westley Weimer
2002-04-16 22:09 ` Sam Edge [this message]
2002-04-17  2:23 ` David Starks-Browning
2002-04-16 22:43 Robert Collins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001001c1e5cd$e95b5da0$e4bcfc3e@nori' \
    --to=sam.edge@ntlworld.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).