A Windows DLL with embedded Node.js for Delphi applications.
DelphiLibNodeJS lets you run JavaScript/Node.js code directly inside a Delphi process — no separate node.exe, no libnode.dll, no third-party DLLs in the distribution package. All dependencies (V8, libuv, OpenSSL, ICU, zlib…) are statically linked into a single DLL.
The API follows the COM style: one flat C export DN_CreateFactory, everything else via COM interfaces with HRESULT return values.
uses DelphiLibNodeJS;
var
Factory : INodeFactory;
Runtime : INodeRuntime;
Log : INodeLog;
Cfg : TDNRuntimeConfig;
Rec : TDNLogRecord;
begin
OleCheck(DN_CreateFactory(nil, Factory));
FillChar(Cfg, SizeOf(Cfg), 0);
Cfg.size := SizeOf(Cfg);
OleCheck(Factory.CreateRuntime(@Cfg, Runtime));
Log := Runtime as INodeLog;
OleCheck(Runtime.Start);
Runtime.RunScriptText('console.log("Hello from Node.js " + process.version)', nil);
Runtime.Stop;
Runtime.Join(5000, nil);
// Delphi ARC: Log, Runtime, Factory are released when they go out of scope
end.- Single DLL — no third-party DLLs in the distribution; only system Windows DLLs
- COM-style API —
INodeFactory,INodeRuntime,INodeLog,INodeNpm,INodeBridge; Delphiasoperator and ARC work natively - npm integration —
INodeNpm.Install,InstallFromPackageJsondirectly from Delphi - Structured log — ring buffer with poll/push modes; captures
console.*, stdout, stderr, unhandled exceptions - ESM and CJS — support for
.mjs/import,top-level await, auto-detect by file extension - Shared node_modules —
extra_module_paths_utf8for reusing installed packages - Bidirectional RPC bridge —
INodeBridge: Delphi calls JS functions (CallFunction), JS calls Delphi objects viaIDispatch(RegisterExport)
# Build the DLL (requires VS 2022 + ClangCL + Python 3.14 + Rust)
.\scripts\BuildHostDll.ps1
# Build and run examples
.\examples\BuildExamples.ps1
.\examples\06_gis\Win64\Release\ExGIS.exe| Section | Description |
|---|---|
| Getting Started | Requirements, installation, first run |
| API Reference | All interfaces, structs, HRESULT codes |
| INodeBridge API | Bidirectional bridge: full reference |
| INodeBridge Guide | Step-by-step bridge guide |
| Build from Source | Node.js + DLL: step-by-step instructions |
| Examples | Description of all 20 examples (0–19) |
| Build Notes | Node.js version, toolchain, build artifacts |
| Component | Version |
|---|---|
| Windows | 10 / Server 2016 x64 or later |
| Visual Studio | 2022 ≥ 17.4 (with ClangCL components) |
| Python | 3.14+ |
| Rust / cargo | stable x86_64-pc-windows-msvc |
| Delphi / RAD Studio | 12+ |
| npm | any current version (for examples 1, 5, 6) |
Node.js (node/) — MIT-compatible component licenses. See node/LICENSE.
DLL and example code — see LICENSE in the repository root.