/* hellogcc.c, gcc program prints "Hello, world" using inline assembler To compile using DJGPP or MINGW in one step: gcc hellogcc.c -o hellogcc.exe To compile, producing intermediate assembly code, hellogcc.s gcc -S hellogcc.c gcc hellogcc.s -o hellogcc.exe */ #include const char msg[] = "Hello, world\n"; main() { // g++ uses AT&T sytle assembly language. See // http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html asm( // Equivalent MASM is: "pushl $_msg\n\t" // pushd offset _msg ; pass argument to printf "call _printf\n\t" // call _printf ; printf(msg); "addl $4, %esp\n\t" // add esp, 4 ; pop argument ); return 0; }