Chungwei Hsiung wrote:
> Hello guys
> I have a question. I've seen things like that being done on some
> articles, but somehow it doesn't work on my machine. If you know how to
> solve this problem, please let me know. I really appreciate it.
> I would like to know how to compile a C file when there are assembly
> code in it like the following:
> void main() {
> __asm__("
> move $0x0, %ebx
> move $0x1, %eax
> int $0x80
> ");
> }
> I tried to compile it, and it doesn't work. Do I miss any library or
> what can I do to resolve this problem???
>
> btw, mine is MDK9.2
>
> best regards,
> Chungwei
Well I got
[EMAIL PROTECTED] tmp]$ cc -c asm_test.c
asm_test.c:2:9: warning: multi-line string literals are deprecated
asm_test.c: In function `main':
asm_test.c:1: warning: return type of `main' is not `int'
/tmp/ccZR2pQa.s: Assembler messages:
/tmp/ccZR2pQa.s:14: Error: no such instruction: `move $0x0,%ebx'
/tmp/ccZR2pQa.s:15: Error: no such instruction: `move $0x1,%eax'
so changing 'move' to mov got rid of the assembler warnings
void main() {
__asm__("
mov $0x0, %ebx
mov $0x1, %eax
int $0x80
");
}
/Bj�rn
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com