including c headers in assembly

Programming, for all ages and all languages.
Post Reply
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

including c headers in assembly

Post 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?
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: including c headers in assembly

Post 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
ru2aqare
Member
Member
Posts: 342
Joined: Fri Jul 11, 2008 5:15 am
Location: Hungary

Re: including c headers in assembly

Post 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.
Post Reply