Mail Archives: djgpp/2000/11/05/13:43:54
excellent! I was trying to get things to work after I posted the message and I
found that (since I am using NT) long filenames under dos isn't enjoyed for
djgpp... I made my object file name smaller and I was able to link up...
now that I can link up and use mixed mode, I am finding that I get a GPF error
as soon as I try to call back a function in my C program... here is my code:
getc.asm --------------------------------------------
.MODEL SMALL
EXTRN _PrintInfo:PROC
.STACK 100H
.CODE
PUBLIC _GetChars
_GetChars PROC
BEGIN:
push BP
mov BP,SP
mov AX,[BP+4]
call _PrintInfo
pop BP
ret
_GetChars ENDP
END
getn.c ---------------------------------------------------------------
#include <stdio.h>
int main() {
int size;
char PrintInfo(char);
extern void GetChars(int);
printf("Please enter the length of the string: ");
scanf("%d", &size);
GetChars(size);
return(0);
}
char PrintInfo(UserInput) {
printf("testing!");
return(0);
}
Any idea as to why I am getting a GPF error with this code? Is it a problem
related to Protected Mode??
Best Regards,
Dan
Eli Zaretskii wrote:
> On Sat, 4 Nov 2000, Danny Byers wrote:
>
> > Hey! I am using MASM 6.11 (which can output the COFF format object
> > files) and I need to interface my assembly code with some C functions
> > that I have written.
>
> Be prepared for a bumpy ride: people who tried this reported problems.
>
> One thing you definitely want to make sure is that the assembly code was
> written for protected mode, not for real mode. See section 17.3 in the
> FAQ for more about this.
>
> > How can I use DJGPP with the object file that I got from MASM? I am new
> > to using DJGPP. What would be the command (ie. gcc file.c asmcode.obj)
> > to include the object file so that my C code will work with the assembly
> > code?
>
> The command you show above is correct: just include the object file(s) as
> part of the link command line.
- Raw text -