From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: HELP! DOS Crashes, Windows Doesn't Date: Wed, 16 Jul 1997 21:26:14 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 48 Message-ID: <33CD3C76.6CDA@cs.com> References: <5qj57h$kqj$1 AT excalibur DOT flash DOT net> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp201.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Joshua Eckstein wrote: > > I've written a simple program to open a PCX file in mode 0x13, fade it from > black, rotate it's palette 256 times, and fade out. I have a problem > because in DOS, it bombs with a traceback once I get to the part where it's > supposed to begin to rotate the palette. In windows, the whole program runs > fine. What > 's going on? What does Windows know that DOS and I don't?! Is it the DPMI > server? The stack? What? Please reply ASAP to kwe1 AT flash DOT net !!! Most likely, CWSDPMI is detecting that your program attempts to dereference a NULL pointer and gives a SIGSEGV. Windows' DPMI host does not detect this sort of thing (it's a feature of DPMI 1.0), so your program goes merrily along doing what it's not supposed to do. To test to see if this is the case, initialize the global _crt0_startup_flags variable with the _CRT0_FLAG_NULLOK flag. If your program now works under DOS, then it's a NULL pointer problem and must be debugged. BTW, to find out exactly where your program crashed, use the 'symify' utility when the crash traceback is still on the screen. This will report the function, file, and line number where the crash occurred; it's then up to you to find and fix it. If you want interactive debugging, use RHGDB, the debugger that accompanies the RHIDE IDE. > P.S. BTW, what does the stack size, etc., that you can edit in stubedit > affect? All automatic variables are allocated from the stack. Since the stack has a fixed size, you must be careful not to use extremely large automatic variables, or nest functions too deeply. The default stack is 256K; if you think you need more, use 'stubedit' to enlarge it, or initialize the global _stklen variable to the desired value in your program. Please get the DJGPP Frequently Asked Questions list (v2/faq210b.zip from SimTel or online at http://www.delorie.com/djgpp/v2faq/), as both of these are answered there. Your first question is answered in chapter 9.1, and your second in chapter 15.9. Hint: when using the 'info' reader that comes with DJGPP, you can search the FAQ for a topic by pressing 's'. -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com | | God's final message to His Creation: | http://www.cs.com/fighteer | | "We apologize for the inconvenience."| <<< This tagline under >>> | | - Douglas Adams | <<< construction >>> | ---------------------------------------------------------------------