delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/07/30/21:07:08

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Originating-IP: [24.34.177.222]
X-Originating-Email: [mgainty AT hotmail DOT com]
From: "Martin Gainty" <mgainty AT hotmail DOT com>
To: <cygwin AT cygwin DOT com>
References: <Pine DOT GSO DOT 4 DOT 44 DOT 0307302101310 DOT 15840-100000 AT slinky DOT cs DOT nyu DOT edu>
Subject: Re: linking with non-cygwin dll
Date: Wed, 30 Jul 2003 21:07:13 -0700
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Message-ID: <Law10-OE230WeOnFl0Y0000dd97@hotmail.com>
X-OriginalArrivalTime: 31 Jul 2003 01:06:58.0281 (UTC) FILETIME=[0A698590:01C35700]

I would go so far as to suggest taking MSVCRT.dll off the path altogether
After all why have 2 runtimes?
-Martin
----- Original Message -----
From: "Igor Pechtchanski" <pechtcha AT cs DOT nyu DOT edu>
To: <vikramshrowty AT fastmail DOT fm>
Cc: <cygwin AT cygwin DOT com>
Sent: Wednesday, July 30, 2003 6:03 PM
Subject: Re: linking with non-cygwin dll


> On Wed, 30 Jul 2003 vikramshrowty AT yahoo DOT com wrote:
>
> > Hi,
> >         I had posted a query earlier about a cygwin program linking
> > with a non-cygwin dll. Based on the very helpful responses and some
googling
> > around, I learnt that this is possible. But...
> >
> > heres a main.c that links with cygwin1.dll
> >
> > int main(void)
> > {
> >   printf("CYGWIN\n");
> >   test_dll();
> >   return(0);
> > }
> >
> > where test_dll is in a dll compiled with -mno-cygwin and is defined
> > like this...
> >
> > __declspec(dllexport) __stdcall void test_dll(void)
> > {
> >   printf("MSFT %d\n",i);
> >   fflush(stdout);
> > }
> >
> > This works perfectly. But, notice the fflush. If this is removed,
> > "MSFT" doesnt get printf'ed. I assuming that this is because the
> > stdout buffer in the microsoft c-library isnt getting flushed
> > automatically at program exit.
> >
> > Any ideas on why?? ..and how to remedy this??
> > --Vikram
>
> Well, gcc links the Cygwin executable with its own C runtime.  MSVCRT is
> another C runtime.  So, when you call the DLL, you have 2 C runtimes
> competing for the same output stream.  This can't be good (in fact, the
> results are unspecified, IIRC).  Thus, the simple remedy is: don't do
> that.  Either only use one runtime for output (whichever one), or fflush
> and pray.
> Igor
> --
> http://cs.nyu.edu/~pechtcha/
>       |\      _,,,---,,_ pechtcha AT cs DOT nyu DOT edu
> ZZZzz /,`.-'`'    -.  ;-;;,_ igor AT watson DOT ibm DOT com
>      |,4-  ) )-,_. ,\ (  `'-' Igor Pechtchanski, Ph.D.
>     '---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!
>
> "I have since come to realize that being between your mentor and his route
> to the bathroom is a major career booster."  -- Patrick Naughton
>
>
> --
> 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/
>
>

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019