Definition:

A Direct Linking Loader is a relocatable loader that performs both loading and linking at runtime. It reads object modules, links external references, and loads code into memory by resolving relative addresses.


🔁 Working of DLL:

The loader does not access the source code directly. Instead, it uses object modules generated by the assembler, which contain metadata required for loading and linking. The object code may use relative addresses, which the loader must convert to absolute addresses during loading.


🔹 The assembler provides the loader with:

  1. Length of the object code.

  2. USE Table: List of external symbols used but not defined in the segment.

  3. DEFINITION Table: List of symbols defined in the current segment and referred by other segments.


🗂️ Databases Built and Used by DLL

1. External Symbol Dictionary (ESD)

  • Contains symbol name, segment type (SD, LD, ER), and its relative/absolute address.

Example:

SymbolTypeLocation
JOHNSD0
RESULT LDLD64
SUMER

2. Text (TXT) Records

  • Contains actual object code, i.e., machine instructions.

Example:

LOAD 1, POINTER   ; 1,48
LD-ADDR 15, SUM   ; 15,56
BALR 14, 15   ; call subroutine
STORE 1, RESULT   ; 1,52
HLT   ; halt

3. Relocation and Linkage Directory (RLD) Records

  • Contains information about where relocation is needed and what external references should be resolved.

Example:

SymbolFlagLengthRelative Location
JOHN+448
SUM+456

4. END Record

  • Indicates end of the program and entry/start point for execution.

📌 Example Summary:

Code Fragment:

START
ENTRY RESULT
EXTERNAL SUM
LOAD 1, POINTER
LD-ADDR 15, SUM
BALR 14, 15
STORE 1, RESULT
HLT

Tables Constructed:

a) POINTER DATA:

Address (TABLE)Value
480028
520001
56???? (external SUM)

b) TABLE DC:

1, 7, 9, 10, 13 → Represent instruction opcodes and memory

c) RESULT NUM: 0

d) ASSUM DATA: ADDR(SUM) → 56 (external)


Advantages of Direct Linking Loader:

  1. Supports multiple procedures and data segments.

  2. Allows independent translation of program modules.

  3. Enables modular design, supports subroutines, data sharing, and access control.

  4. Provides relocation and linking flexibility.