delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/04/13:40:31

From: "Matthew Conte" <spam AT somebody DOT else>
Newsgroups: comp.os.msdos.djgpp
Subject: SIGSEGV under DOS, but not Win9x?
Lines: 33
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
Message-ID: <XlOR1.447$l93.2198969@proxye1.nycap.rr.com>
Date: Sun, 4 Oct 1998 13:36:15 -0400
NNTP-Posting-Host: 24.92.55.44
X-Complaints-To: abuse AT nycap DOT rr DOT com
X-Trace: proxye1.nycap.rr.com 907522551 24.92.55.44 (Sun, 04 Oct 1998 13:35:51 EDT)
NNTP-Posting-Date: Sun, 04 Oct 1998 13:35:51 EDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

[Please reply to the group, email is invalid, sorry if this bothers you.]

For some reason, the following code segfaults under plain DOS, but not in a
DOS box.  Here is the smallest snippet possible.

/* begin code */

typedef unsigned char byte;
typedef struct {
   byte *Data;
   int W,H;
} BITMAP;

int VGANewBitmap(BITMAP *bmp,int W,int H)
{
   bmp->Data = (byte *)malloc(W*H);
   if (bmp->Data==NULL) { bmp->W=bmp->H==0; return -1; }
   memset(bmp->Data,0,W*H); bmp->W=W; bmp->H=H;
   return 0;
}
/* end code */

I get an immediate segfault if I use the declarations:
   BITMAP *bitmap;
   VGANewBitmap(bitmap,256,240);

This happens only under DOS+cwsdpmi, but not under Win9x.  I absolutely can
not figure this out.  Can anyone shed some light on this?

Thanks,
Matt Conte.


- Raw text -


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