testing subprograms as external files in nasm. After running :
nasm -f elf subprogram2.asm
nasm -f elf get_int.asm
I then run the gcc:
Quoting from the NASM manual:
GLOBAL
is the other end ofEXTERN
: if one module declares a symbol asEXTERN
and refers to it, then in order to prevent linker errors, some other module must actually define the symbol and declare it asGLOBAL
.
So if get_int
is defined in get_int.asm you should put the global get_int
in get_int.asm, and declare it as extern
in any other files that want to use get_int
.