Date: Mon, 6 Nov 2000 09:13:27 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Danny Byers cc: djgpp AT delorie DOT com Subject: Re: using COFF object file from MASM to compile C In-Reply-To: <3A05AA54.229C4FAE@magma.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 5 Nov 2000, Danny Byers wrote: > getc.asm -------------------------------------------- > .MODEL SMALL > EXTRN _PrintInfo:PROC > .STACK 100H I think ".MODEL SMALL" and ".STACK 100H" might be a cause of your trouble. Also, don't you need a .386 directive, to make the code 32-bit? > BEGIN: > push BP > mov BP,SP > mov AX,[BP+4] > call _PrintInfo You are calling PrintInfo without pushing its argument onto the stack. What's more serious, PrintInfo calls `printf', which needs vast amounts of stack space. You also don't preserve registers that GCC-generated code assumes to be loaded with certain values; see section 17.4 of the DJGPP FAQ list. > Any idea as to why I am getting a GPF error with this code? Is it a problem > related to Protected Mode?? Probably. But you didn't post the full crash message printed when your program GPFaults, so it is very hard to tell. You might consider running the program under a debugger, to see where exactly does it crash, and what is the machine instruction that causes the crash. That might give you a clue.