Subject: RE: Cygwinb19.dll
From: [email-masked] (Colin Peters)

25 Jun 1998 07:42:50 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
To: <[email-masked]>
Cc: "GNU-Win32" <[email-masked]>

[email-masked]
<[email-masked]> wrote:

[someone else wrote:]
># If you don't like
># that requirement, go rewrite the source code of the compiler itself and
set
># it up so that each EXE has all those functions included within them.
This
># has the disadvantage of increases every single executable's size by half
a
># meg.  It's your choice.

That's a bit harsh. You don't have to rewrite the compiler and linker, you
just have to recompile libcygwin32.a to be a static library instead of a DLL
import library for cygwin32.dll (or whatever the name is now).

>'Proper' (no insult intended to the genii behind gnu-win32) Unix systems
have
>the
>capability to produce "statically" or "dynamically" linked executables.
From
>what I understand
>of M$'s terminology, DLL's (*dynamic* link libraries), are required for
>dynamically linked
>EXEs. So surely the answer is to get gcc/ld to produce statically linked

Yeesssss... Dynamic link libraries, DLLs, are required by programs that
contain references to them, which I suppose you could call dynamically
linked executables. However, practically all Win32 programs require at least
one of the Win32 API DLLs, directly or through some other library or DLL, so
basically all Win32 programs are dynamically linked. To achieve something
like a UNIX statically linked executable what you need to do is make sure
you don't link any DLLs which don't come with the operating system.

gcc and ld are perfectly capable of statically linking libraries on Win32.
The problem is getting the library. Cygnus builds their library as a DLL
because that way every program shares the single library file, making for
smaller exes and making upgrades to the library simple (just drop in a new
dll). If you want to link statically you need to build a static version of
the library from source. This would be simple for an ordinary library, but,
if I'm not mistaken, newlib does some stuff with shared memory between all
instances of the DLL (i.e. all programs that use the DLL), which would be
difficult to do with a static lib. Please correct me if I'm wrong.

Given that you could build newlib as a static library then you could simply
replace the current libcygwin32.a with the static library and everything
would work (ha ha).

BTW, your program wouldn't necessarily be 0.5 meg larger either, because
static linking only includes the objects in the library which are referenced
by your program. However, because libraries tend to have cross references
this may turn out to be a lot of stuff you don't actually *use*, but may not
be the whole library.

So, either you can rebuild newlib as a static library, or you can distribute
a copy of cygwin's dll with your program (or you can use Mingw32, but that
would be a shameless plug :-) ).

Colin.

-- Colin Peters - colin at fu.is.saga-u.ac.jp
-- Saga Univ. Dept. of Information Science
-- http://www.geocities.com/Tokyo/Towers/6162/index.html
-- http://www.fu.is.saga-u.ac.jp/~colin/index.html

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".