From: Klaus Petzold 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 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 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