This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Statically linking programs??




Mark Paulus wrote:
> 
> I was looking through the FAQ, and I see about an option to
> build binaries that link either the cygwin or the Micro$oft
> dlls.  However, I do not see an option to build statically linked
> binaries that require no dlls.  Is this a possibility??

Not under windows.  All windows programs require a runtime library of
some sort (like "glibc" on linux).  On the windows platform, all of the
available runtime libraries are dynamic libs (dlls).  This includes:
  msvcrt.dll  (microsoft runtime)
  crt.dll     (older microsoft runtime)
  cygwin1.dll (cygwin runtime)

> 
> (-static doesn't seem to have any effect:
> man gcc:
>        -static
>               On  systems that support dynamic linking, this pre-
>               vents linking with the shared libraries.  On  other
>               systems, this option has no effect.
> )

Incorrect.  "-static" causes the linker to *prefer* static libs over
dynamic libs, but if there is only a dynamic lib then the linker goes
ahead and uses it rather than bail out and fail.  In the case of runtime
libraries, there are only dll's -- so you will always dynamically link
to one of the runtimes.

--Chuck

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]