Mixing C and nasm
Posted: Sat Jan 19, 2008 11:49 am
Hello all. I am newly registered here but I have read many posts, searched for many things and have had many questions answered.
I am sorry if this has already been asked but my searches yielded no good results. So now for my first question here!!!
I am developing under Linux using gcc, nasm and ld
I would like to know how to mix NASM with C. Can someone point me to a tutorial for this? or just lay it out for me in a reply? (either is ok)
Example of what I am trying to do:
C file:
I want to be able call functions created in nasm from C.
Thanks in advance for the any help.
I am sorry if this has already been asked but my searches yielded no good results. So now for my first question here!!!
I am developing under Linux using gcc, nasm and ld
I would like to know how to mix NASM with C. Can someone point me to a tutorial for this? or just lay it out for me in a reply? (either is ok)
Example of what I am trying to do:
Code: Select all
; File: Readchr.asm
global rdchr
rdchr:
mov eax, 0x01
...
ret
Code: Select all
; File: Main.c
extern void rdchr;
int main()
{
rdchr();
}
Thanks in advance for the any help.