Hello all! I am trying to link assembly code to my c application. I am using Dev-cpp with gcc, and my assembler is nasm. Here is the C code that i came up with:
and here is the assembly code:Code:#include <stdio.h>
extern PrintHello (void);
int main ()
{
char ch;
ch = PrintHello ();
printf ("%d", ch);
}
I tried to assemble the code into ELF object format, win32 object format, and coff format. The problem is the program just keeps crashing. It compiles fine with coff and ELF, but it wont run. Can anyone tell me how to assemble and link this code into my program? Sorry if this is an inappropriate post for this board, but i couldnt think of anywhere else to turn! Im kinda new at all this kind of stuff, so go easy on meCode:segment _CODE
global _PrintHello
_PrintHello:
MOV AH,0x09
MOV DX,[msg]
INT 0x21
RET
segment _DATA
msg db "Hello!$"