CALL and Linker

A link library is a file containing procedures (subroutines) that have been assembled into
machine code. A link library begins as one or more source files, which are assembled into object
files. The object files are inserted into a specially formatted file recognized by the linker utility.
Suppose a program displays a string in the console window by calling a procedure named
WriteString. The program source must contain a PROTO directive identifying the WriteString
procedure:
WriteString proto

Next, a CALL instruction executes WriteString:

call WriteString

When the program is assembled, the assembler leaves the target address of the CALL instruction
blank, knowing that it will be filled in by the linker. The linker looks for WriteString in the
link library and copies the appropriate machine instructions from the library into the program’s executable file.

In addition, it inserts WriteString’s address into the CALL instruction. If a procedure
you’re calling is not in the link library, the linker issues an error message and does not
generate an executable file.

Assembly Language for x86 Processors 7th
p154

posted @ 2022-05-12 22:59  fndefbwefsowpvqfx  阅读(28)  评论(0编辑  收藏  举报