This folder is the result of reverse engineering of the Quick
Library format of Microsoft QuickBASIC 4.0 / 4.5: the file
format, how QuickBASIC loads a library, how it calls into it,
and how to write one. Everything is written down, checked
against the real QuickBASIC 4.50 and 4.0 and against Microsoft's
own QB.QLB, and released into the public domain
(Unlicense, (c) DosWorld 2026). Use it for anything, without
conditions.
A Quick Library is the file that QuickBASIC loads with QB /L name.QLB. It contains compiled routines (assembler, C, anything
that produces .OBJ) that a BASIC program in the QuickBASIC
editor can then CALL. Without it the QuickBASIC interpreter
can only run BASIC: no interrupts, no absolute addresses, no
hand-written inner loops, no hardware access. With it a program
can do CALL INTERRUPT(...), CALL ABSOLUTE(...) (that is the
library QB.QLB that ships with QuickBASIC) or call your own
routines.
Technically it is a DOS MZ executable that nobody runs, used as a container: code image, data, a symbol block with name tables, and an MZ relocation table. QuickBASIC maps the pieces into memory, relocates them, and then talks to the library through a small table of far pointers (a dispatcher with a life cycle: load, init, find a routine by name, terminate).
QB /L MYLIB.QLB /RUN PROG.BAS
DECLARE FUNCTION SUMI% (a AS INTEGER, b AS INTEGER)
PRINT SUMI%(1000, 234) ' assembler routine from MYLIB.QLB- For QuickBASIC 4.x programmers: essential. It is the only
way to extend the editor/interpreter. Anything that needs a
DOS or BIOS call, a port, a TSR, speed, graphics or a hardware
driver goes through a Quick Library. The same assembler
routines can also be linked into a compiled
.EXE(as.OBJ), so a library is a convenient way to develop them. With the documentation here you can write libraries with NASM and the free RTools linker (rlink qlb) and need neither MicrosoftLINKnorBQLB45.LIB. - For other DOS programs: a small, ready-made plug-in format
- useful, but niche. A
.QLBis a relocatable module with named exports, its own data segment, a list of relocations and life-cycle hooks, loadable withoutEXEC, at any address, by a small 8086 assembler loader (ALOADER\ALOADER.ASM). You can use it as an overlay, plug-in, driver or script-extension container for your own DOS software, and any QuickBASIC 4.x user can load the same file. Its limits: one 64 KB data segment laid out for QuickBASIC 4.5, no import table (a library can take only what QuickBASIC offers at fixed places), names found through a dispatcher, and RLINK and MicrosoftLINK /Qas the only writers. If you do not care about QuickBASIC, a plain RDF or MZ overlay with your own loader is simpler.
- useful, but niche. A
- For preservation: the format was undocumented; now it is documented and checked by working code.
QLBFMT.MD- what it is: The format specification. File layout, MZ header, QB header, the three tables, memory model, relocation, the dispatcher and its selectors, the calling convention, imports, limits, QuickBASIC's refusal checklist, an annotated byte dump, assembler examples.
QLBUSE.MD- what it is: Consumer manual. Part A: using a library from a QuickBASIC program (parameters, return values, errors, pitfalls). Part B: loading a library from your own DOS program: load, relocate, resolve exports and imports, phases with codes, call routines, unload - with the assembler code.
QLBWRT.MD- what it is: Writer guide. Writing routines in NASM
(stack frames for every parameter type, return values), the
life cycle hook, imports, data, linking with
rlink qlb, testing, hang checklist, writing a.QLBwithout RLINK.
- what it is: Writer guide. Writing routines in NASM
(stack frames for every parameter type, return values), the
life cycle hook, imports, data, linking with
MSRT.LST- what it is: Disassembly of the runtime that Microsoft's
LINK /Qembeds (dispatcher,GETPROC, service thunks,Init,Term...), annotated, with the variables of QuickBASIC's data segment.
- what it is: Disassembly of the runtime that Microsoft's
QLOADER\- content: A QuickBASIC program calls a library written in
NASM, with parameters of every kind.
DEMO.ASM(the library),DEMO.QLB(built),DEMO.BAS(the BASIC program),MAKE.BAT,RUN.BAT,OUTPUT.TXT(output of the run under QuickBASIC 4.50). It needsQB.EXEto run: a.QLBis not an.EXE.
- content: A QuickBASIC program calls a library written in
NASM, with parameters of every kind.
ALOADER\- content: A DOS program in NASM that loads a
.QLBand calls it, playing the part of QuickBASIC, with all the phases (06h,10h,00h,0Ahper name,00h,02h,04h), the imports (DS:00D3, the gatewayDS:00BE/00C2) and the calls.ALOADER.ASM,ALOADER.EXE(built),DEMO.ASM,DEMO.QLB,MAKE.BAT,RUN.BAT,OUTPUT.TXT(full run),OUTLOAD.TXT(aloader QB.QLB /L: Microsoft's own library passes every check).
- content: A DOS program in NASM that loads a
Try it:
cd ALOADER
aloader DEMO.QLB full run, no QuickBASIC needed
aloader C:\QB45\QB.QLB /L load and check any library
cd ..\QLOADER
qb /l DEMO.QLB /run DEMO.BAS same routines from BASIC
(needs QuickBASIC 4.5 or 4.0)
The linker rlink qlb of RTools follows these findings:
- Imports. A module may
externthe names of QuickBASIC (B$RUNERR,B$ERR_FC,b_errnum,b_ULSymSeg...); RLINK builds the thunks and data symbols itself (DEMO.ASMuses it). - Lookup. Like Microsoft's runtime:
CDECLnames get the underscore, case is ignored, the temporary name string is freed (QLBFMT.MDsection 12), and the CODE table lists the exported names.
NASM 0.98.39 and the linker RLINK of
RTools (BIN\NASM.EXE,
BIN\RLINK.EXE), under MS-DOS or DOSBox-X:
nasm -s -f rdf DEMO.ASM
rlink qlb /o=DEMO.QLB DEMO.RDF
nasm -s -f rdf ALOADER.ASM
rlink mzs /o=ALOADER.EXE ALOADER.RDF
- QuickBASIC 4.50 and 4.0 (
QB.EXE) for the file format and the life cycle; the demo programs ofQLOADERunder 4.50. - Microsoft's
QB.QLBof QuickBASIC 4.5: read and accepted byALOADER(all checks); BASIC PDS 7.1 files were read only. - QBasic (
QBASIC.EXEof MS-DOS 5/6) has no/Loption and does not load libraries.
- Only one library can be loaded by QuickBASIC (
/Ltwice prints the usage line); all modules have to be linked into one. - Not examined: selectors
04h 08h 0Ch 0Ehat run time, STRING function results, far data/BSS areas, QuickBASIC PDS at run time. ALOADERruns libraries made by RLINK; libraries made byLINK /Qare loaded and checked only.
(c) DosWorld 2026. Public domain: the Unlicense, full text
in LICENSE.TXT and in the header of every
source file. Microsoft, QuickBASIC and MS-DOS are trademarks of
Microsoft Corporation; this project is not affiliated with
Microsoft and contains no Microsoft code or files, except
MSRT.LST, a commented disassembly of the runtime that LINK /Q embeds, published for interoperability and documentation;
check the rights that apply to you. QB.QLB is not included;
the loader only reads it.