X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; q=dns; s=default; b=Hk
	07Sk13xmlQ0uWQHXIKc5uTPQL3nnoLjIN6Zpa/ok0GG1UjAMBDpq0vk7VSXWA1Po
	YhK3ILZ/gDiMaFu60WXuqrazyecC5qB4P1EoGc+UnD/YA/cJtgfOc83O6l1yjA5H
	NjyCQtoJVjD2t9qLLX3RczF5ZPxS0JsOkQ9RVwBVk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; s=default; bh=b4m97pqa
	hbjkP+PUucXyt6XZSFo=; b=VsMnPzadRTrVs60KBujne2BzxWvgR7RhoRJNQhkW
	x1Xrorjomri9I2/Hi7vJGbUceNfC9/ZKxgTg4jpRU8C3m88AKtEGVmelJZd/nnck
	nVlD8rCeKMuwHA9ShWt40JEUjVHyNzY5MR2Rpvw8+YnWHBwj73h5Qu/f0OG+dG/G
	k8w=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,UNSUBSCRIBE_BODY autolearn=no version=3.3.2
X-HELO: mail-la0-f49.google.com
MIME-Version: 1.0
X-Received: by 10.112.146.162 with SMTP id td2mr20127060lbb.40.1416217693289; Mon, 17 Nov 2014 01:48:13 -0800 (PST)
In-Reply-To: <OFA16137E6.A98D47F2-ON48257D93.002FE9C9-48257D93.00304419@ni.com>
References: <OFA16137E6.A98D47F2-ON48257D93.002FE9C9-48257D93.00304419@ni.com>
Date: Mon, 17 Nov 2014 10:48:13 +0100
Message-ID: <CAO1jNwvJ2gM=Mi-pxjzE42bKBW17f0jr7BsGTRMyFsG41i+sgA@mail.gmail.com>
Subject: Re: Question about having msvcrt*.dll and cygwin1.dll in one process
From: Jan Nijtmans <jan.nijtmans@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes

2014-11-17 9:47 GMT+01:00 Jing Zhao <jing.zhao@ni.com>:
> The outputs:
> welcome to linux world
> res: 7777777
> it's over
>
> So everything look fine. According to the FAQ 6.15, is there anything
> that's potentially dangerous that I should be aware of, when linking both
> msvcrt.dll and cygwin1.dll? Thanks a lot!

If it works, then you are simply lucky. Some pitfalls I know off:

- when using stdin/stdout/stderr, msvcrt and cygwin1.dll have
  their own implementation, which might conflict: locking over
  multiple threads works differently, buffering is different. So
  if both your application and the dll write to stdout, the
  order in which both outputs are intermixed is not guaranteed.
- exception handling is different. Don't expect an exception being
  thrown in the dll to be handled gracefully in the application.
- threading functions are different, same story.
- dll initialization is different (recently a bug was fixed
  regarding this, in a pre-fix version of cygwin1.dll your
  current example might simply crash)

That are just 3 pitfalls I know of, I'm sure there are more.

So in stead of stating that it doesn't work, a better formulation
would be that it is unsupported. But don't expect any
fundamental help here, it's tricky stuff (apart from the
question who really would want this .......)

Regards,
     Jan Nijtmans

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

