delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/12/19/15:59:06

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Matthew Woehlke <mw_triad AT users DOT sourceforge DOT net>
Subject: Re: "cout" and "cerr" won't work after cygwin1.dll init from VC++
Date: Tue, 19 Dec 2006 14:58:23 -0600
Lines: 30
Message-ID: <em9jpf$cuh$1@sea.gmane.org>
References: <20061219210916 DOT isuasdydhw4cwcc4 AT webmail DOT unizar DOT es>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.0
In-Reply-To: <20061219210916.isuasdydhw4cwcc4@webmail.unizar.es>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

Francisco J. Royo Santas wrote:
> I have a VC++ program that uses a Cygwin-compiled DLL. I can init cygwin1.dll
> but, after doing this, cout and cerr stop working. cout << "Message" << endl
> does not appear on the screen. I do not know exactly what happens here. The
> program is:

/me repeats Dave's comment

> cout << "Before" << endl;   // Appears
> HMODULE cygwinDll = LoadLibrary("cygwin1.dll");
> void (*init)() = (void (__cdecl *)(void)) GetProcAddress(cygwinDll,
> "cygwin_dll_init");
> init();
> cout << "After" << endl;    // Does nor appear
> 
> What is going on here?? What do I have to do to have cout and cerr back
> normally??

Does it work if you /don't/ use cout before cygwin_dll_init()?

My guess would be "don't expect to be able to use cout/cerr before /and/ 
after calling cygwin_dll_init()". This just "feels" like something that 
would not work, nor should you probably be doing it. I would think that 
calling cygwin_dll_init() needs to be /the very first thing you do/. In 
fact, doing anything with stdin/stdout/stderr (i.e. stdio too) before 
and after is probably a bad idea unless you know what you are doing.

-- 
Matthew
This message is non-smoking


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