From: Thomas Demmer Newsgroups: comp.os.msdos.djgpp Subject: Re: Compiles OK but fails on execution Date: Wed, 06 May 1998 16:09:22 +0200 Organization: Lehrstuhl fuer Stroemungsmechanik Lines: 64 Message-ID: <35506F12.9F0F72CA@LSTM.Ruhr-UNI-Bochum.De> References: NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de 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 J.C. Austin wrote: > > Hi, > > I have a problem with a small program compiled using DJGPP in a Windows 95 > environment. This program compiles and runs OK under UNIX but I need to run > it on a PC. There was no apparent problem with the compilation under DJGPP, > however the output obtained while running is displayed below. > > This program is designed to take a 768x512 pixel "RAW." monochrome image with > 0-255 grey levels (b), and with the aid of a light reference image (bb) and a > dark reference image (b1) it corrects for any background variation. The > intended output in this case is ws1. > > I've tried updating libm.a with a patch as suggested in the FAQ but this > made no difference. > > I've searched for "environ.lst" using explorer and it doesn't seem to exist > anywhere on the hard drive. Also I'm not sure where to find the output of > go32-v2. However along with the program output I'm sending copies of > "autoexec.bat" and "config.sys". The PC I'm running this on is a Pentium 166 > with 32 MB RAM and 2 GB hard drive. > > Please email me if you need any further info. I'd appreciate any > suggestions. Recompile and relink it with the option -g, to add debug info. Run the program and then run symify on the traceback to see where the program crashes. Without actually seeing the source, there are several reasons why it might crash: You open the file in standard mode, like foo=fopen(bar,"r"); which means text mode under DOS, and don't care under UNIX. So, change these occurrences to "rb" and "wb" when working on binary files. Alignment within structs might be a reason if you just copied over the file from UNIX. Getting them via ftp and forgetting to set the transfer to "bin" is a nice error. Even then, the endianness might be a reason. Writing binary files that might be read on other hosts should always be converted with htons() and alikes. -- Ciao Tom ************************************************************* * Thomas Demmer * * Lehrstuhl fuer Stroemungsmechanik * * Ruhr-Uni-Bochum * * Universitaetsstr. 150 * * D-44780 Bochum * * Tel: +49 234 700 6434 * * Fax: +49 234 709 4162 * * http://www.lstm.ruhr-uni-bochum.de/~demmer * *************************************************************