extern : Assure assembler that the function will is defined someplace else.
global : Any procedure marked global can be referenced from anywhere.
===========================================================================
blank.asm ( name of file )
; simply returns 0
GLOBAL _blank
section .text
_blank:
mov eax, 0
ret
===========================================================================
test.c ( name of file )
#include
extern int _blank();
int
main(){
int ret = 5;
ret = _blank();
printf("Ret is [%d]\n",ret);
return 0;
}
===========================================================================
$ nasm -felf blank.asm -> outputs -> blank.o
$ gcc -o test test.c blank.o
$ ./test
Ret is [0]