🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #2159

DLLs using cout,cin,cerr blow up

#2159
From: John Panzer
Date: Fri, 20 Nov 1992 08:47
20 lines
1160 bytes
The title just about says it all.  When I put code that uses the
standard streams cout, cin, or cerr into Windows DLLs & compile
with Borland, the DLL generally crashes the system upon unloading
(under 3.0) or generates a mysterious fault (3.1).  It seems to
be due to stack overflow (looks like a very small system stack
is being used).

Why would these streams appear in a Windows program in the first
place?  Well, my problem appeared in a third-party library which
used cerr for critical error messages.  I didn't even know it
was there until I traced through the shutdown code & saw the
destructors...

The problem has been solved by getting rid of all references to cerr.
Bottom line, it seems that static objects with destructors in DLLs
are a Bad Idea.

John Panzer
johnrp@well.sf.ca.us
Technical Details
Message-ID: <By0B37.403@well.sf.ca.us>
Path: arc1-ca.pugleaf.net!sparky!uunet!well!johnrp

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!well!johnrp
From: johnrp@well.sf.ca.us (John Panzer)
Subject: DLLs using cout,cin,cerr blow up
Message-ID: <By0B37.403@well.sf.ca.us>
Sender: news@well.sf.ca.us
Organization: Whole Earth 'Lectronic Link
Distribution: na
Date: Fri, 20 Nov 1992 08:47:31 GMT
Lines: 20