delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/08/31/22:49:32

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: global constructor using iostreams fail
31 Aug 1998 22:49:32 -0700 :
Message-ID: <9809010519.AA04800.cygnus.cygwin32.developers@modi.xraylith.wisc.edu>
To: cygwin32-developers AT cygnus DOT com

Does anybody have an idea why the streambuf vtable is not being
initialized correctly in cygwin32 apps? Basically, the following
fails:
  
  #include <iostream.h>

  struct Foo {
    Foo () { cout << " creating foo." << endl;
    ~Foo () { cout << " deleting foo." << endl;
  };

  Foo foo;
  int main () {
    return 0;
  }

Looks like the io jump tables aren't being initialized before main, and
the code in cout ends up trying to dereference a null pointer (to a 
function _IO_xsputn or some such).

I don't understand cygwin startup enough to understand what's going on.
The complexity of libio doesn't help matters much either.

This works just fine under other x86-win32 targets.

Regards,
Mumit

- Raw text -


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