Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!srhqla!demott!kdq From: kdq@demott.COM (Kevin D. Quitt) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: NULL pointer error Keywords: Null dos error Message-ID: <402@demott.COM> Date: 16 Jul 90 18:51:23 GMT References: <2008@bnlux0.bnl.gov> Reply-To: kdq@demott.COM (Kevin D. Quitt) Organization: DeMott Electronics Co., Van Nuys CA Lines: 33 In article <2008@bnlux0.bnl.gov> reilly@bnlux0.bnl.gov (kevin reilly) writes: >After exiting my program DOS writes an error to the screen >NULL pointer error R6001 >I understand the meaning of the error message but how do I go about >debugging the program to find what is causing it. >From reading the documentation from MicroSoft (QC2.5) the program will >compile and link error free. But when run and then exited that is when >the error will appear. >The program ran error free up until I linked in the menu.obj file that >came with the compiler. >I guess the question is: What memory address do I watch when stepping >through the program? Microsoft C reserves the first chunk of your data segment (starting at DS:0) to help protect you against yourself. If you look at a link map, you will see a segment called NULL. The NULL segment contains the Microsoft copyright and some other miscellaneous non-junk. When your program exits, the MS library checks to see if you've corrupted this area (generally by using a null pointer) and reports the R6001 error if you have. If you're using codeview, you can look for uninitialized pointers, or pointers that get clobbered. You can also look at DS:0 to see if you recognize the data there. Good Luck -- _ Kevin D. Quitt demott!kdq kdq@demott.com DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266 VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 PEP last 96.37% of all statistics are made up.