Using a Cygwin-built DLL outside of Cygwin

Christian Kreibich
Thu Oct 18 16:43:00 GMT 2007

Hi Thorsten,

On Wed, 2007-10-17 at 23:53 +0100, Thorsten Kampe wrote:
> > My questions:
> > 
> > - Is there a Cygwin-only way to avoid the MSVC lib command detour, to
> > avoid the "multiple .text sections" issue?
> > 
> > - I have gleaned from related postings and FAQ 6.12 that the crashes are
> > due to the use of cygwin1.dll and msvcrt.dll (and/or related Windows
> > DLLs) in the same executable. Is this correct?
> > 
> > - If so, is there a way to avoid the problem while still building the
> > library in my cozy Cygwin/POSIX environment? My understanding is that
> > -mno-cygwin doesn't help in that regard (per FAQ 6.10), and that I have
> > to keep cygwin1.dll (per FAQ 6.11).
> > 
> > - If getting rid of msvcrt.dll is the answer, what are the implications
> > for building Windows-native applications? (And, assuming this is
> > possible, if a kind soul could tell me how I'd go about doing this even
> > though it's not a question at the heart of this list, that'd be much
> > appreciated...)
> Aren't these FAQs?

I hope not. :) For starters, I don't think my first question has
anything to do with the FAQs you're pointing out.

> * Can I link with both MSVCRT*.DLL and cygwin1.dll?
> cygwin

Yes. As I mentioned above, I have actually read those. My second
question is whether the crashes I am seeing are likely to be a
consequence of this.

> * How do I use cygwin1.dll with Visual Studio or MinGW?

Thanks for pointing this one out. This may answer my last two questions,
and I'd in fact seen the FAQ entry, but wrote it off to a serious case
of impedance mismatch. I found how-cygtls-works.txt at

and read it. Unfortunately it is unclear how a discussion of the NT_TIB
structure from <w32api/winnt.h> relates to my question. The other
reference, winsuite/testsuite/cygload, appears to be emptry:

I'll now try to get this snippet also mentioned in the FAQ to work:

  HMODULE h = LoadLibrary("cygwin1.dll");
  void (*init)() = GetProcAddress(h, "cygwin_dll_init");


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list