With lwpt
hotfpc doesn't need lwpt, but the two get along. lwpt
writes the unit paths of your package and its dependencies to lwpt.cfg, an fpc response
file. hotfpc passes that file to fpc and watches every directory listed in it, so edits to
a dependency's units are swapped in too.
A run task
Add a task to lwpt.toml that starts your program under hotfpc:
[hot]
command = "hotfpc"
args = ["@lwpt.cfg", "source/greeter.pas"]On Windows, hotfpc needs a 64-bit program, and the installer's fpc builds 32-bit ones unless
told otherwise (Windows programs). lwpt run passes no arguments to a task,
so give Windows a task of its own with fpc's target options:
[hot-windows]
command = "hotfpc"
args = ["-Twin64", "-Px86_64", "@lwpt.cfg", "source/greeter.pas"]Then lwpt install writes lwpt.cfg, and lwpt run hot starts the program, or
lwpt run hot-windows on Windows:
lwpt install
lwpt run hotlwpt build still builds the program on its own, without hotfpc, for what you ship.
The example
examples/lwpt is a complete package made with lwpt init, with
that task. Its program prints a line from source/greeting.pas every second. Run it, then
change the text in source/greeting.pas and save:
tick 4: hello again, reloaded
[hot] v2 swapped: greeting: 1 functions redirected (1 with other code, 0 new), 0 variables and tables kept, 0 new, 144 bytes; 168.0 ms after the save was seen (settle 15.0, compile 134.0, interface check 9.0, load 10.0 of which in the program 8.885)
tick 5: hello from a swapped unitThat run used lwpt 0.8.1 on Linux x86-64 with fpc 3.2.4-rc2+1, on 2026-11-24.
Things to know
- The task's
argsare hotfpc's arguments, so hotfpc's own options go there too:args = ["--log", "hot.log", "@lwpt.cfg", "source/greeter.pas"]. - A dependency that lwpt adds later is a new directory in
lwpt.cfg. hotfpc reads the response file when it starts, so runlwpt run hotagain afterlwpt install. .hot/is written next to the program's source, heresource/.hot/. Add.hot/to the package's.gitignore.