[A83] Re: What is a linker?


[Prev][Next][Index][Thread]

[A83] Re: What is a linker?




> Van: Jimmy Pardey <j_pardey@hotmail.com>
> 
> A linker is a program that adds data to a compiled program to tell the 
> operating system that the build is for the right processor and operating 
> system, right?

Yes, that can be a part of it.

Let's see these two pieces of code (z80asm syntax, somewhat)

[File Asm1.asm]
	XDEF foobar
	jp	foobar

[File Asm2.asm]
	XREF	foobar
foobar:
	ret

You compile both of them to an object format (not quite same as the ".obj"
files that TASM outputs). The first one then contains info that it misses a
reference to 'foobar'. The second file contains the info that 'foobar' is
located at a certain adress in that file.

The linker (when invoked, dûh) will put these two files together and
"resolve
the references". That's the "unresolved references" error when you compile
something and you miss a certain file/lib. For most Z80 OSes it should then
also write the adresses so the code executes from a fixed adress (ex: $9327
on the Ti83).

	Henk Poley <><