npm install node-ctypes
node-ctypes requires Node.js 24 or later. The npm package includes a prebuilt binary for each platform below, so installing it needs no C++ compiler. The Quick start shows a first program.
The addon is resolved relative to the installed package or Electron's unpacked
application resources, never the current working directory. If a custom bundle
keeps the binary elsewhere, set NODE_CTYPES_NATIVE_PATH before importing
node-ctypes to the absolute path of a trusted .node file. An invalid override
is an error; it does not fall back to another binary.
| Operating system | x64 | ARM64 | Minimum version |
|---|---|---|---|
| Windows | ✅ | ✅ | |
| macOS | ✅ | ✅ | macOS 13.5 |
| Linux, glibc | ✅ | ✅ | glibc 2.28 |
| Linux, musl (Alpine) | ✅ | ✅ |
Each binary is built and tested on its own platform by the continuous integration: the whole test suite runs with Node 24, normally and without external buffers (as in Electron), and the Python ctypes reference tests run with CPython 3.14 on Windows, macOS and Linux glibc. The suite runs again with Node 26 on Windows x64, macOS ARM64 and Linux x64, which also runs the references with CPython 3.15.
All these targets are 64-bit and have a single C calling convention. WinDLL,
WINFUNCTYPE and the stdcall, fastcall and thiscall options are
accepted, so code written for Windows APIs runs unchanged, and they use that
convention.
Requires Node.js >= 24, CMake >= 3.15, and a C++20 compiler, standard library
and platform assembler (MSVC ml64/armasm64 on Windows, Clang or GCC on macOS
and Linux). There are no external C/FFI submodules. From the source checkout:
npm install
npm run build
Building, testing and internals covers the tests, the benchmarks and the native code.