delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/11/24/05:05:39

From: IBEC23 AT cc DOT uab DOT es
Date: Mon, 24 Nov 1997 11:00:53 +0100 (GMT)
Subject: Re: system calls generate Segm.Viol. on NT
To: djgpp AT delorie DOT com, djgpp-workers AT delorie DOT com
Message-id: <01IQDW607BOI00Q9FK@cc.uab.es>
Organization: Universitat Autonoma de Barcelona
MIME-version: 1.0

Dear programmers,

Some days ago we posted a simple code that crashed under
NT 4.0 because some strange behaviour of the system() call.

As we still worked with DJGPP v2.00, we upgrade to DJGPP v2.01 but
without success. The problem persisted.

Following Eli recommendations, we used:

  #include <crt0.h>
  int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK;

at the beginning of the code, and it really worked (thanks Eli!!).

We have learned that under NT we must use this; otherwise, if we include
some system() call and we later access some file, the program will probably
crash. Althought our problem is already solved, it suggest the possibility
of initializing this variable to _CRT0_FLAG_UNIX_SBRK already in the default
DJGPP compilation to avoid problems in the increasing users of NT.
But perhaps there is some important inconvenience in using
  _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK
in DOS, Win. 3.1x or Win. 95. Is there someone that could provide info
about drawbacks of this?

Thank you!

Xavier Pons & Joan Maso

- Raw text -


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