test$ ls bin fpc.sh lib test.a testasm.asm testasm.o test.pas test$ cat fpc.sh #! /bin/bash FPCDIR="$(dirname "$0")" "$FPCDIR"/bin/ppcross8086 -vi -Tmsdos -WmSmall \ -Fu"$FPCDIR"/lib/fpc/3.2.2/units/msdos/8086-small/rtl \ "$@" test$ cat testasm.asm section CODE public align=16 extern depackersize global prepare prepare: mov word [depackersize], 26 retn test$ cat test.pas program test; var depackersize:word;cvar; procedure prepare;external; {$L testasm} begin prepare; end. test$ nasm -fobj testasm.asm -o testasm.o && ./fpc.sh test.pas Free Pascal Compiler version 3.2.2 [2021/05/17] for i8086 Copyright (c) 1993-2021 by Florian Klaempfl and others Target OS: MS-DOS 16-bit real mode Compiling test.pas test.pas(3,5) Note: Local variable "depackersize" not used Linking test.exe test.pas(10,1) Error: Undefined symbol: depackersize test.pas(10,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted test$