在汇编程序中调用C函数
/*
*funcc.c
*/
#include <stdio.h>
void func(int *x)
{
*x += 1;
printf("%d\n", *x);
}
#funcs.s
.section .data
x:
.int 1
.section .text
.globl _start
_start:
pushl $x
call func
movl $1, %eax
movl $0, %ebx
int $0x80
/*
* 编译命令:
* as -o funcs.o funcs.s
* gcc -c -o funcc.o funcc.c
* ld -dynamic-linker /lib/ld-linux.so.2 -lc -o func funcc.o funcs.o
* /


浙公网安备 33010602011771号