Subject: Re: Using a Cygwin-built DLL outside of Cygwin
From: Christian Kreibich <[email-masked]>
To: [email-masked]
Cc: Thorsten Kampe <[email-masked]>
Date: Thu, 18 Oct 2007 09:42:20 -0700
List-Id: <cygwin.cygwin.com>

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?
> http://cygwin.com/faq/faq.programming.html#faq.programming.msvcrt-and-
> 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?
> http://cygwin.com/faq/faq.programming.html#faq.programming.msvs-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

http://cygwin.com/cgi-bin/cvsweb.cgi/~checkout~/src/winsup/cygwin/how-cygtls-works.txt?rev=1.1&content-type=text/plain&cvsroot=src

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:

http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/testsuite/cygload/?cvsroot=src

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");
  init();

Cheers,
Christian
-- 
________________________________________________________________________
                                           http://www.icir.org/christian
                                                    http://www.whoop.org

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/