Function Entry: LOAD
← Prev | ↑ Chapter | Next → | Index | Symbols
Function Entry: LOAD
Name
load
Class
Function
Syntax
(load filename [onfailure])
Arguments and Values
filename: source or compiled Lisp file designatoronfailure: optional failure-handling argument
Description
Loads an AutoLISP or compatible file into the current environment.
File encoding
load has no encoding parameter, and this is the asymmetry to
remember: open gained one in 2021, load did not. The encoding of a
source file is therefore decided entirely by its first bytes.
Since BricsCAD V20, load accepts source files stored as Unicode:
- UTF-8, little-endian byte order;
- UTF-16, little-endian byte order.
For both, Bricsys states that the byte-order mark is absolutely required, and that UTF-8 without a BOM "might fail".
With no BOM the file is decoded with the host system codepage
(SYSCODEPAGE). The consequence is worth spelling out, because it looks
like a bug in the program rather than in the file: a non-BOM cp1252
source cannot be portably loaded. On Windows it happens to work, since
the host codepage matches what the author used; on macOS
SYSCODEPAGE is MACROMAN and the same bytes decode to different
characters, with no error raised at any point. The file is read, the
program runs, and the strings are wrong.
The portable form is therefore UTF-8 with a BOM — the one spelling every post-V20/2021 engine identifies without guessing.
Note also that the extension search order differs by vendor: BricsCAD's
load tries name.des then name.lsp, where Autodesk documents
.vlx, .fas, .lsp (below).
Return Values
If loading succeeds, Autodesk documents the return value as unspecified.
If loading fails:
- the value of
onfailureis returned if that argument is supplied, - if
onfailureis a valid AutoLISP function, it is evaluated, - if
onfailureis omitted, an AutoLISP error is signaled.
Side Effects
- reads and evaluates forms from the target file
- may establish functions, variables, and other definitions
Affected By
- search path rules
- trusted-path rules
- environment profile
- file encoding rules
- filename extension search rules
Exceptional Situations
File and load errors are host- and version-sensitive.
Compatibility
Autodesk documents the extension search order used when filename has no extension:
.vlx.fas.lsp
As soon as a match is found, loading stops and that file is loaded.
That search order applies only when filename carries no extension.
When an extension is given explicitly, the file is read as LISP source
whatever that extension is — verified 2026-08-09 on all four engine
combinations: (load "foo.alpm") evaluates the file on clautolisp, on
BricsCAD V25 and V26, and on AutoCAD 2022. The compiled formats are
recognised by being found under the search order above, not by any
rejection of unfamiliar extensions; an explicit extension bypasses the
search entirely. Applications may therefore choose their own source
extension freely.
Source Notes
- Bricsys, BricsCAD Developer Reference V25,
load— https://developer.bricsys.com/bricscad/help/en_US/V25/DevRef/source/load.htm (the V20 Unicode support, the little-endian requirement and "the BOM is absolutely required" are verbatim from that page). - The same rules explain
cad-load-encoding-macos.issueandcad-chr-vs-loaded-encoding.issue: neither is a separate defect, both are this one encoding rule observed from two angles.
Notes
Autodesk also documents that VLX support is Windows-only.
In clautolisp, load is gated by the trust model: at SECURELOAD 2 a
source/executable file in an untrusted location is blocked (ERRNO 73 and
a :load-untrusted-file error, or the onfailure value when supplied),
at 1 it warns and proceeds, and a trusted file is always allowed. The
user init files the engine auto-loads (~/.autolisp and its XDG
variants) are trusted by exact path unless --no-init is given. Relative
names are resolved through the support search path. See Normative Rules:
Secure File Loading and Trust Model (this chapter).
Availability
- AutoCAD 2026: documented (per Autodesk reference page).
- AutoCAD 2022, BricsCAD V25 and V26: the explicit-extension rule above was verified by runtime probe 2026-08-09 on every engine.
- Status: verified on both vendors (no longer "presumed compatible").
Source Notes
- [load (AutoLISP)](https://help.autodesk.com/cloudhelp/2023/ENU/AutoCAD-MAC-AutoLISP-Reference/files/GUID-F3639BAA-FD70-487C-AEB5-9E6096EC0255.htm)
- Runtime probe: alpm
tests/verification/verification.lsp(V-1), 2026-08-09. - Status: documented.