Mail Archives: djgpp/1998/09/27/15:45:19
From: | Klaus Petzold <califax AT wupperonline DOT de>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Why GPF?
|
Date: | Sun, 27 Sep 1998 16:24:57 +0100
|
Organization: | Customer of SpaceNet GmbH
|
Lines: | 46
|
Message-ID: | <360E58C8.1F87EAD1@wupperonline.de>
|
NNTP-Posting-Host: | line7.kdt.de
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi,
I get a General Protection Fault when I run the following
program under DJGPP. But why is "t" not allowed to access
"a" via "*t"? Is there a way to get around this problem?
tia
Klaus
->filename "test.cc"
#include "ttt.h"
unsigned char a = 123, b;
int main()
{
b = readchar(&a);
}
->filename "ttt.h"
#include "ttt.h"
unsigned char *t;
unsigned char readchar(unsigned char *ptr)
{
unsigned char a;
a = (*t);
return(a);
}
->filename "ttt.cc"
#ifndef ttt_h
#define ttt_h ttt_h
extern unsigned char *t;
unsigned char readchar(unsigned char *ptr);
#endif
- Raw text -