LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   inserting assembeled functions into c (https://www.linuxquestions.org/questions/programming-9/inserting-assembeled-functions-into-c-518616/)

andystanfordjason 01-12-2007 05:44 AM

inserting assembeled functions into c
 
hi, i am currently writing a c program. it would be really useful for me if i was able to compile to assembly a function in the c code and put it back into the program in that form. is this possible?
i.e. i want to get one of the functions in my program and compile it to assembly then put that assembly into the place where the function was.
if this is possible then it be very grateful for any help. thanks

paulsm4 01-12-2007 09:56 AM

Hi, again -

I thought you already got the answer to that question. For example, the syntax for adding in-line assembly using the GNU C compiler is discussed here:

DeveloperWorks: Inlining Assembly for C

If you want to see the assembly generated by the compiler, simply use the "-S" switch:
Quote:

gcc -S ...
'Hope that helps .. PSM

andystanfordjason 01-12-2007 01:59 PM

its not quite as simple as just plonking the assembeled code in i dont think and i wondered if anyone had any advice. cheers anyhow


All times are GMT -5. The time now is 08:18 AM.