Page 1 of 1

including c headers in assembly

Posted: Fri Jan 23, 2009 12:51 pm
by yemista
How do you include a c header file in an assembly file under binutils? Lets say I define a function in func.c, declare it in func.h, and want to call it from func.s by including func.h. Does it matter or do you just declare the function external within func.s and let the linker patch it up?

Re: including c headers in assembly

Posted: Fri Jan 23, 2009 12:56 pm
by DeletedAccount
use extern directive provided by the assembler instead :) . you can offcourse use the same #include and use the c preprocessor (macro processor) , if all you want to do is include the file.

Regards
Shrek

Re: including c headers in assembly

Posted: Fri Jan 23, 2009 1:01 pm
by ru2aqare
There is a tool called h2inc or something, that converts C header files into assembler-processable include files. Haven't tried it though.