How to compile Assembly inline with C
Make sure you have 32-bit libraries, install them:
Make sure you have 32-bit libraries, install them:
apt-get install gcc-multilib
#include <stdio.h>
char Format[] = "Hello world, %d\n";
int main (void)
{
asm
(
"subl $8, %esp\n"
"movl $3, 4(%esp)\n"
"movl $Format, (%esp)\n"
"call printf\n"
"addl $8, %esp\n"
);
return 0;
}
gcc -m32 test.c -o test.o; ./test.o
http://stackoverflow.com/questions/11378181/use-printf-function-in-inline-asm-on-gcc