# Changelog

All notable changes to this project are documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.17.1] - 2026-12-04

Linux ELF hardening & CI verification, CPython 3.14 untyped/callback parity
fixes, `aotffi` ARM64/x64 ABI & layout fixes, and expanded `noexcept` fast-path
entries.

### Added

- **Linux ELF hardening & CI check**
  ([`CMakeLists.txt`](./CMakeLists.txt),
  [`deps/aotffi/CMakeLists.txt`](./deps/aotffi/CMakeLists.txt),
  [`.github/scripts/check-linux-elf.sh`](./.github/scripts/check-linux-elf.sh),
  [`.github/workflows/build.yml`](./.github/workflows/build.yml),
  [`deps/aotffi/src/asm/aot_aarch64_posix.S`](./deps/aotffi/src/asm/aot_aarch64_posix.S),
  [`deps/aotffi/src/asm/aot_sysv_x64.S`](./deps/aotffi/src/asm/aot_sysv_x64.S)):
  Linux Release builds enable full RELRO (`-Wl,-z,relro,-z,now`), Intel CET
  branch protection (`-fcf-protection=branch` on x86-64), and ARM64 BTI
  (`-mbranch-protection=bti`), and the npm packaging workflow inspects every
  final Linux `.node` binary in the tarball with `check-linux-elf.sh`.

### Fixed

- **Untyped scalar width & reentrant conversion isolation**
  ([`lib/core/conversions.js`](./lib/core/conversions.js),
  [`lib/core/invocation.js`](./lib/core/invocation.js),
  [`lib/types/scalar-protocol.js`](./lib/types/scalar-protocol.js),
  [`src/function.cc`](./src/function.cc),
  [`src/function_async.cc`](./src/function_async.cc),
  [`src/function_fast.cc`](./src/function_fast.cc),
  [`src/addon.cc`](./src/addon.cc)): preserve the width of explicitly typed
  scalars (including `c_float`) in calls without `argtypes` across sync,
  `callAsync()`, and `callOn()`, snapshot `ConvertEntryExtras` per call so a
  getter calling another binding cannot overwrite previously converted
  arguments, and prevent replacing the active extra-argument converter mid-call.
- **Callback `c_wchar_p` lifetime, `callOn`, and pointer adapter errors**
  ([`lib/core/callback-conversions.js`](./lib/core/callback-conversions.js),
  [`lib/core/funcptr.js`](./lib/core/funcptr.js),
  [`lib/memory/pointer.js`](./lib/memory/pointer.js),
  [`lib/memory/pointer-ops.js`](./lib/memory/pointer-ops.js),
  [`guides/callbacks.md`](./guides/callbacks.md)): preserve `c_wchar_p` callback
  results after the trampoline is released and emit the CPython-compatible
  `RuntimeWarning: memory leak in callback function.`, restore bound `callOn`,
  and preserve indexed `ArgumentError` for pointer adapters.
- **Byte-swapped scalars, Linux ARM64 HFA alignment, and `aotffi` move/validation safety**
  ([`deps/aotffi/src/classify.cc`](./deps/aotffi/src/classify.cc),
  [`deps/aotffi/include/aotffi/classify.h`](./deps/aotffi/include/aotffi/classify.h),
  [`deps/aotffi/include/aotffi/types.h`](./deps/aotffi/include/aotffi/types.h),
  [`deps/aotffi/include/aotffi/call.h`](./deps/aotffi/include/aotffi/call.h)):
  fix 8-byte byte-swapped scalar arguments and Linux ARM64 stack alignment for
  over-aligned homogeneous floating-point aggregates, avoid repeated recursive
  validation of shared aggregate layouts, and clear moved-from state in
  `CallSignature` and `CallbackSignature` move operations.

### Performance

- **Expanded `noexcept` native entries & inferred-call fast path**
  ([`src/function_fast.cc`](./src/function_fast.cc),
  [`src/function_marshal.h`](./src/function_marshal.h),
  [`src/napi_fast.h`](./src/napi_fast.h),
  [`src/abi_call.cc`](./src/abi_call.cc)): converted `AllInt32Entry`,
  `ScalarFrameEntry`, `UnaryStringEntry`, `UnaryPointerCall`, and
  `ExtraPointerCall` to `noexcept` C-API entries, added `InferredEntry` /
  `MatchInferredExtras` for fast untyped/variadic calls, and added
  `DirectFramePlan::needs_gp_zero` to skip redundant register zeroing.

## [2.17.0] - 2026-12-03

Standalone zero-dependency C++20/assembly AOT FFI backend (`deps/aotffi`)
replacing `libffi`, Windows Control Flow Guard (`/guard:cf`) hardening, $O(1)$
incremental aggregate layout construction, and synchronous Node-API hot-path
entry optimizations.

### Added

- **Standalone `aotffi` static library (`deps/aotffi`, target `aotffi::aotffi`)**
  ([`deps/aotffi/CMakeLists.txt`](./deps/aotffi/CMakeLists.txt),
  [`deps/aotffi/README.md`](./deps/aotffi/README.md),
  [`deps/aotffi/include/aotffi/`](./deps/aotffi/include/aotffi/aotffi.h),
  [`deps/aotffi/src/`](./deps/aotffi/src/classify.cc)):
  - Pure C++20 (`PUBLIC cxx_std_20`) and static `.text` assembly FFI engine with
    zero Node-API or external runtime dependencies, covering Win64, System V
    x86-64 (Linux, macOS), and ARM64 (Linux `glibc`/`musl`, Apple Silicon
    Mach-O, Windows ARM64) for forward calls (`ExecuteCall`, `DirectCallFrame`),
    variadic calls, by-value structs/unions/HFAs/over-aligned aggregates, `long
    double` (x87 80-bit, IEEE binary128, binary64), and static W^X/CET/BTI/PAC
    callback trampolines (`SlotHandle`, `AllocateCallbackSlot`,
    `ActivateCallbackSlot`) with lock-free `in_flight` tracking and deferred
    slot reclamation.
  - Target-ABI-aware LP64/LLP64 scalar data model (`TypeSize`, `TypeAlignment`,
    `IsCharSigned`, `IsWCharSigned`) supporting cross-ABI offline classification
    and strict signature/layout validation (`IsHostExecutable()`).
  - Dedicated standalone CTest suite (`npm run test:aotffi`:
    `aotffi_test_classify`, `aotffi_test_calls`, `aotffi_test_callbacks`,
    `aotffi_test_cfg_consumer`) wired into CI across Windows, Linux
    (`glibc`/`musl` + UBSan), and macOS, including `CTYPES_MAX_CALLBACKS=1` /
    `AOTFFI_MAX_CALLBACKS` capacity checks.
- **Version and native callback capacity metadata**
  ([`src/addon.cc`](./src/addon.cc), [`lib/index.d.ts`](./lib/index.d.ts)):
  `Version.backend` reports `'aot'` (`Version.libffi = '0.0.0-aot'`), and the
  native addon exposes `maxCallbacks` matching the compiled
  `CTYPES_MAX_CALLBACKS` / `AOTFFI_MAX_CALLBACKS` pool size (default `4096`,
  configurable in `1..65535`).
- **Windows Control Flow Guard (`/guard:cf`) support**
  ([`CMakeLists.txt`](./CMakeLists.txt),
  [`deps/aotffi/CMakeLists.txt`](./deps/aotffi/CMakeLists.txt),
  [`deps/aotffi/src/asm/aot_win64.asm`](./deps/aotffi/src/asm/aot_win64.asm),
  [`deps/aotffi/src/asm/aot_win_arm64.asm`](./deps/aotffi/src/asm/aot_win_arm64.asm),
  [`.github/workflows/build.yml`](./.github/workflows/build.yml)): indirect
  calls in the Win64 and Windows ARM64 assembly trampolines dispatch through
  `__guard_dispatch_icall_fptr` / `__guard_check_icall_fptr`, all static
  callback stub symbols are exported into the PE `.gfids` table, and Release
  Windows `.node` binaries are compiled, linked, and CI-verified with
  `/guard:cf`.

### Changed

- **Addon AOT integration** ([`src/abi_call.h`](./src/abi_call.h),
  [`src/abi_call.cc`](./src/abi_call.cc),
  [`src/abi_callback.h`](./src/abi_callback.h),
  [`src/abi_callback.cc`](./src/abi_callback.cc),
  [`src/layout.h`](./src/layout.h), [`src/layout.cc`](./src/layout.cc)):
  `FFIFunction`, `Callback`, `ThreadSafeCallback`, and `StructInfo` delegate
  ABI classification, direct-frame offsets (`CallSignature::direct`), generic
  calls, and static callback trampolines to `aotffi::aotffi`, with `StructInfo`
  using `aotffi::StructLayout` as its single source of truth and preserving
  strong exception safety (`std::bad_alloc`) when adding fields.

### Removed

- Removed the `third-party/libffi` submodule, `third-party/libffi_cmake`,
  `src/libffi_*.{h,cc}`, and `src/call_frame.h`.

### Fixed

- **Linux ARM64 stack aggregate alignment**
  ([`deps/aotffi/src/classify.cc`](./deps/aotffi/src/classify.cc)): distinguished
  natural member-inherited alignment from external type alignment (`_align_`)
  when placing spilled composite arguments on the AAPCS64 stack and
  reconstructing callback argument pointers under UBSan.
- **Windows ARM64 variadic composite arguments**
  ([`deps/aotffi/src/classify.cc`](./deps/aotffi/src/classify.cc)): disabled HFA
  register unpacking for variadic arguments on `kWinArm64`, packing `<= 16 B`
  composites into general-purpose registers and passing `> 16 B` composites by
  indirect pointer.
- **Narrow integer return normalization in `InvokeDirectFrame`**
  ([`deps/aotffi/include/aotffi/call.h`](./deps/aotffi/include/aotffi/call.h)):
  sign- and zero-extends narrow integer return values into `AbiWord` identically
  to `ExecuteCall`.
- **Immutable finalized layouts and one-shot callback slot activation**
  ([`deps/aotffi/include/aotffi/types.h`](./deps/aotffi/include/aotffi/types.h),
  [`deps/aotffi/include/aotffi/callback.h`](./deps/aotffi/include/aotffi/callback.h),
  [`deps/aotffi/src/callback.cc`](./deps/aotffi/src/callback.cc)): froze
  `StructLayout` and `ArrayLayout` against post-`Finalize()` mutation and move
  emptying, enforced transitive acyclicity, made numeric `SlotHandle` adoption
  private, and restricted `ActivateCallbackSlot` to a single
  reserved-to-active transition.
- **Pointer hint `ArgumentError` parity**
  ([`lib/core/conversions.js`](./lib/core/conversions.js),
  [`src/function_marshal.h`](./src/function_marshal.h)): kept fractional number
  rejection messages (`0.5` on `c_void_p` / `c_char_p`) identical between cold
  and hinted pointer paths.

### Performance

- **Zero-EH-frame `noexcept` synchronous Node-API entries**
  ([`src/napi_fast.h`](./src/napi_fast.h),
  [`src/function_fast.cc`](./src/function_fast.cc),
  [`src/function_marshal.h`](./src/function_marshal.h),
  [`src/foreign_fault.h`](./src/foreign_fault.h),
  [`src/callback_threadsafe.cc`](./src/callback_threadsafe.cc)): flattened
  `NullaryEntry<T>`, `UnarySameEntry<T>`, `MixedEntry<Count>`,
  `CoreDirectEntry<R>`, `DirectPointerCall`, and host-thread
  `DispatchThreadSafeNative` with checked raw Node-API helpers, inline MSVC
  `__try/__except` fault guards, inline $\le 64\text{ B}$ `InitDirectFrame`
  stack zeroing, and `AOTFFI_ALWAYS_INLINE` scalar extension in
  `ExtendScalarToGpWord` (~20–30% faster nullary, narrow-integer, and `i64`
  calls on native Windows ARM64).
- **$O(1)$ incremental `StructLayout` construction**
  ([`deps/aotffi/include/aotffi/types.h`](./deps/aotffi/include/aotffi/types.h),
  [`src/layout.cc`](./src/layout.cc)): replaced quadratic per-field rescans with
  incremental offset/alignment updates (~80x faster layout construction on
  2048-field structures).

## [2.16.4] - 2026-12-02

Modular C++20 native call-backend headers, narrow integer marshalling cleanup,
ILP32/GCC visibility fixes, multi-worker callback regression test, and updated
architecture documentation.

### Changed

- **Modular Node-API/libffi-free C++20 call headers**
  ([`src/call_platform.h`](./src/call_platform.h),
  [`src/c_types.h`](./src/c_types.h),
  [`src/call_plan.h`](./src/call_plan.h),
  [`src/call_prepare.h`](./src/call_prepare.h),
  [`src/call_fixed.h`](./src/call_fixed.h),
  [`src/call_frame.h`](https://github.com/dmazzella/node-ctypes/blob/v2.16.4/src/call_frame.h)):
  - Replaced `src/call_abi.h`, `src/direct_call.h`, and `src/frame_call.h`
    with dedicated C++20 ABI/call headers independent of Node-API, libffi,
    and `StructInfo`.
  - Moved calling conventions (`CallConv`, `StringToCallConv`), `CType`
    scalar metadata/sizes/alignments, `AbiWord`, `LoadAs`, return-value
    load/store helpers, and `VisitScalarCType` out of
    [`src/shared.h`](./src/shared.h) and [`src/types.h`](./src/types.h) into
    [`src/call_platform.h`](./src/call_platform.h) and
    [`src/c_types.h`](./src/c_types.h).
  - Unified fixed-invoker and register-frame selection into `abi::CallPlan`
    and `abi::PrepareCall`, replacing separate `fixed_invoker_`/`frame_plan_`
    fields across [`src/function.h`](./src/function.h),
    [`src/function.cc`](./src/function.cc),
    [`src/function_fast.cc`](./src/function_fast.cc),
    [`src/function_async.cc`](./src/function_async.cc), and
    [`src/libffi_call.cc`](https://github.com/dmazzella/node-ctypes/blob/v2.16.4/src/libffi_call.cc).
- **Narrow integer marshalling**
  ([`src/function_marshal.h`](./src/function_marshal.h)): added
  `NarrowFromNumber<T>` for `int8`/`uint8`/`int16`/`uint16` JS `number`
  arguments using a direct `int64_t` fast path with low-bit truncation and
  fallback to `IntegerBitsFromDouble`.
- **Documentation** ([`FLOWS.md`](./FLOWS.md),
  [`guides/contributing.md`](./guides/contributing.md),
  [`guides/callbacks.md`](./guides/callbacks.md)): aligned diagrams and
  contributor architecture notes with the new `src/call_*.h` and
  `src/c_types.h` layout, corrected the synchronous callback handle-scope
  reuse budget to `2048`, and documented keeping stored C callback wrappers
  alive until unregistered and all in-flight calls return.

### Added

- Multi-worker callback isolation test in
  [`tests/node_specific/test_callback_release.js`](./tests/node_specific/test_callback_release.js)
  verifying that live callback pointers and JS handlers remain distinct across
  `worker_threads` `Worker` environments.

### Fixed

- Guarded 64-bit register-frame ABI selection in
  [`src/call_frame.h`](https://github.com/dmazzella/node-ctypes/blob/v2.16.4/src/call_frame.h) with `!defined(__ILP32__)` so
  AArch64 ILP32 and x86-64 x32 targets cleanly fall back instead of matching
  LP64 paths, and scoped `#pragma GCC visibility push(hidden)` strictly to
  internal invokers (restoring `#pragma GCC visibility pop` before
  `struct Plan` to prevent GCC `-Wattributes` diagnostics).
- Updated the `v2.16.3` changelog reference to `src/direct_call.h` to link
  directly to the `v2.16.3` tag blob so it remains valid after the rename to
  [`src/call_fixed.h`](./src/call_fixed.h).

## [2.16.3] - 2026-12-01

Performance improvements for by-value struct/HFA calls, x86-64 System V and
Win64 direct invokers, async struct calls, and variadic/inferred calls.

### Fixed

- Public by-value results remain independent even when looking up `toObject`
  reenters the same binding. The built-in encoder reads only own fields,
  once and in declaration order, with or without `errcheck`.
- Closing a thread-safe callback no longer releases an already-closing Node-API
  handle a second time. Function-pointer adapter chains are bounded.
- Read-only memory views hide backing-store aliases (`.buffer`, `.parent`),
  pass the read-only facade to iteration callbacks, and reject in-place
  decoders (`setFromHex`, `setFromBase64`) when present; writable mirrored
  views flush decoded bytes (including partial prefixes on `SyntaxError`).
- Native addon resolution no longer searches the current directory. Custom
  bundles can set `NODE_CTYPES_NATIVE_PATH` to an absolute `.node` file.
- 32-bit source builds do not compile the 64-bit direct-call backend. A/B
  comparisons distinguish inconclusive runs from confirmed regressions.

### Added

- Cross-platform examples ([`examples/cross-platform/sqlite/`](./examples/cross-platform/sqlite/README.md)
  for custom JavaScript SQLite UDFs, aggregates and collations, and
  [`examples/cross-platform/box2d/`](./examples/cross-platform/box2d/README.md)
  for Box2D v3 physics with HFA structs, raylib, web Canvas SSE and native OS
  windows).
- Architecture and runtime flow diagrams in [`FLOWS.md`](./FLOWS.md).

### Performance

- **Direct C++ invokers for aggregates and full x86-64 parity**
  ([`src/direct_call.h`](https://github.com/dmazzella/node-ctypes/blob/v2.16.3/src/direct_call.h),
  [`src/function_fast.cc`](./src/function_fast.cc)):
  - Extended `direct::Select` to common by-value struct and HFA shapes up to 64
    bytes (`() -> S`, `(scalar) -> S`, `(T, T) -> S`, `(S) -> S`, and
    `(S) -> void | scalar`) across AArch64, x86-64 System V (including mixed
    GP/SSE 12–16 byte classes), and Win64 (register `<= 8 B` power-of-two vs
    indirect `> 8 B`).
  - Enabled `float` and `double` scalar arguments on x86-64 System V
    (`R (*)(A..., ...)` setting `AL`) and Win64 (variadic dual-register
    `ToWin64DualReg`).
  - Added `CoreDirectEntry<StructReturn>` and `UnaryStructCall<ReturnsStruct>`
    fast entries for direct by-value struct arguments and results.
- **Compiled scalar `struct()` encoder/reader and sync scratch reuse**
  ([`lib/structures/helpers/struct.js`](./lib/structures/helpers/struct.js),
  [`lib/core/conversions.js`](./lib/core/conversions.js),
  [`lib/core/invocation.js`](./lib/core/invocation.js)): `struct()` definitions
  with 1–16 simple scalar fields (up to 256 bytes) compile a `DataView`-backed
  object reader (caching `DataView` over the reused result buffer) and
  plain-object encoder into a per-binding scratch `Buffer` (with `scratchBusy`
  reentrancy guard across arities 2–4 in `specializeCall` and arities 2–3 in
  `buildResultSyncMethod`, and `allocTransient` fallback on non-primitive
  values or `create`/`set` overrides).
- **Async struct calls without redundant copies or persistent refs**
  ([`src/layout.h`](./src/layout.h), [`src/layout.cc`](./src/layout.cc),
  [`src/struct.cc`](./src/struct.cc), [`src/function.h`](./src/function.h),
  [`src/function.cc`](./src/function.cc),
  [`src/function_async.cc`](./src/function_async.cc),
  [`lib/core/native-aggregate.js`](./lib/core/native-aggregate.js),
  [`lib/core/results.js`](./lib/core/results.js),
  [`lib/core/invocation.js`](./lib/core/invocation.js)):
  - `struct()`/`union()` async return converters install
    a cached handler (`_setAsyncResultHandler`, held weakly in C++ and owned via
    a `WeakMap` in JS) and call `_callAsyncResult`. Compiled scalar readers of
    4- and 8-byte results receive an immutable word with all the original bits;
    other handlers receive an independent `Buffer`. No completion borrows the
    binding's synchronous result buffer.
  - `PrepareAsyncCall` skips `copied_refs` retention for valid views of
    pointer-free structs (`!StructInfo::HasAddressFields()`, propagated
    explicitly via `hasAddressFields` from `native-aggregate.js` across packed
    and bitfield layouts), and unary async plain-struct calls reuse
    `makeSyncPlainResolver`.
- **Variadic and inferred call fast paths**
  ([`src/function_fast.cc`](./src/function_fast.cc),
  [`src/libffi_call.cc`](https://github.com/dmazzella/node-ctypes/blob/v2.16.3/src/libffi_call.cc),
  [`lib/core/invocation.js`](./lib/core/invocation.js),
  [`lib/core/conversions.js`](./lib/core/conversions.js),
  [`lib/types/scalar-protocol.js`](./lib/types/scalar-protocol.js)): split
  `TryExtraFrameCall` fixed/extra loops with exact `int32_t` fast paths
  (`CTYPES_INT32` / `!needs_typed_extras`), added `_callExtra`
  (`FFIFunction::ExtraPointerCall`) for `DirectPointerCall` bindings and wired
  it into `specializeCall` case 2 (`len > 2`), cached `entryRead` per
  `scalarTypeInfo` in `convertEntryExtras()`, and added `primaryScalarAccessor`
  lookup in `scalarInstanceInfo()`.

## [2.16.2] - 2026-11-30

Performance improvements for pointer-handle calls, C string returns, and
raw-address reads, with no behavior changes.

### Performance

- `readValue()` on a numeric or `BigInt` address now reads `c_void_p`,
  `c_size_t`, `c_ssize_t`, and `c_bool` natively instead of allocating an
  external `Buffer` per call, also speeding up `POINTER(c_void_p)` indexing.
- A `c_void_p` handle passed as a `BigInt` address, `null`, or `undefined`
  now takes the direct native call path for 1–4 argument signatures without
  running the JavaScript pointer converter on each call, with per-position
  type hints across `Buffer`, `BigInt`, and `null` calls (and direct string
  forwarding for `c_char_p` arguments in 2–4 argument calls).
- Functions returning `c_char_p` from a single pointer or `c_char_p`
  argument, or from 2–4 pointer/integer arguments, now convert the returned
  string on the direct native path.

## [2.16.1] - 2026-11-29

Fixes from a review of 2.16.0: memory safety of asynchronous result
conversion, thread-safe callback release, struct results and field setters,
over-aligned returns and resizable buffers, and remaining CPython 3.14
`ctypes` differences. The parity fixes change what a few accesses return
(a subclass field of a byte-swapped layout, a bit field of a subclass), as
CPython does.

### Fixed

- **Memory safety**:
  - `callAsync()` / `callOn()` with a `restype` that converts the result
    (`_check_retval_`, a callable restype, a structure or pointer type) now
    convert it before the call releases its argument copies. A result that
    pointed into a string argument (`strchr`) could be read after it was
    freed.
  - `ThreadSafeCallback.release()` while other threads call it: a thread now
    acquires the thread-safe function before queuing, so `release()` cannot
    close it in between, and the trampoline stays valid until the callback is
    collected. A thread inside the trampoline could run a callback created
    later in the freed closure, or the process could stop on a libuv
    assertion (`UV_HANDLE_CLOSING`). A `callback()` called by mistake from
    another thread also keeps its trampoline until it is collected.
  - A failed `dlopen()` with no `dlerror()` message no longer dereferences a
    NULL pointer (Linux, macOS).
  - The Buffer in which a synchronous call returns a structure by value is
    reused at every call and exposed by the internal raw API
    (`fn._ffi.call()`). It is now a view of a `SharedArrayBuffer`, which
    cannot be detached. A raw caller that detached it (`transfer()`) made the
    next call write into memory owned by the new `ArrayBuffer`, possibly
    already freed. Where `SharedArrayBuffer` is not available (for example
    `--enable-sharedarraybuffer-per-context`), a detached Buffer is replaced
    instead.
  - A field setter of a native `StructType` instance converts the value into
    a copy of the field and writes it afterwards. A getter or `valueOf()` run
    by the conversion that detached the instance's memory made the rest of the
    conversion write into released memory; it now throws
    `TypeError: Invalid struct buffer`.
  - Structures and arrays with `_align_` above 16 are returned through a
    buffer with their alignment, in synchronous calls (fast path included),
    `callAsync()` and `callOn()`. The return buffer was aligned to 16 bytes
    only, while the callee may store into it with instructions that require
    the aggregate's alignment.
  - A view left out of bounds by shrinking its resizable `ArrayBuffer` during
    a call is reported like a detached one: a synchronous call whose callbacks
    shrank it throws, and `callAsync()` / `callOn()` reject, with
    `memory was detached (transfer() or a transfer list) or shrunk out of bounds ...`.
    Only detached memory was detected.
  - On x86-64 Linux and macOS, a zero-size structure marked to be passed in
    memory (`memoryClass`, set for layouts with unaligned fields) no longer
    makes libffi recompute its size from the 64-byte marker and read past the
    argument. This case has no test: it needs AddressSanitizer.
- **CPython parity**:
  - A field of a simple-type subclass in a byte-swapped layout is an instance
    of its swapped type (`MyInt` in a `BigEndianStructure` is `MyInt_be`,
    derived from `c_int`), so `s2.x = s1.x` works; it was a `MyInt` that the
    field rejected. `MyInt.__ctype_be__` is now a subclass of `MyInt`'s base.
  - A bit field of a simple-type subclass returns an instance over the whole
    storage unit, as CPython (`PyCData_FromBaseObj`); it returned the bits'
    value.
  - Arrays and pointers of a `c_char` / `c_wchar` subclass slice to a string
    (Python: bytes / str), and `POINTER(MyChar)` rejects a `c_char` buffer
    (`incompatible types, c_char_Array_4 instance instead of LP_MyChar
instance`).
  - Array types in a byte-swapped layout are the interned
    `ARRAY(T.__ctype_be__, n)` (or `__ctype_le__`), and `ARRAY(T, n)` itself
    for 1-byte elements, so `Outer.a.type === ARRAY(c_int32.__ctype_be__, 2)`.
  - `pointer()` and `byref()` of an empty Structure, or of one with a field
    named `constructor`, point to that class (`pointer(Empty()).contents` is
    an `Empty`).
  - A `CFUNCTYPE(c_bool)` callback result is converted by its truth value, as
    CPython's `bool_set`: `[]` and an empty Buffer are false, any other object
    is true (`_as_parameter_` is not consulted).
  - Accessors defined by a `POINTER(T)` subclass run with the pointer as
    `this`, so `this[0]` reads the pointee.
  - `_align_` (and the `align` option of `struct()`, `union()` and
    `defineStruct()`) takes a boolean or a BigInt as a Python int (`8n` is
    8, `true` and `false` are 1). A non-integer number is a Python float:
    accepted while a larger field alignment prevails (`0.5`), otherwise
    `TypeError: an integer is required`; above the `Py_ssize_t` range it is
    `RangeError: Python int too large to convert to C ssize_t`. They were all
    a `RangeError`, and the `align` option rejected a string with a
    `RangeError` instead of the `TypeError` of `_align_`.
- **JavaScript protocols**: `Object.keys()`, `in` and
  `Object.getOwnPropertyDescriptor()` of an array (an instance or a field)
  see its element indices, not the byte indices of its memory.
- `util.inspect()` of a read-only `memoryview_at()` view (and of mirrored
  views) shows its bytes instead of throwing `argument must be a buffer`.
- **TypeScript**: `POINTER()` accepts array and function pointer types,
  `LibraryLoader()` is callable without `new`, the `slice()` of a
  `POINTER(c_char)` / `POINTER(c_wchar)` is a `string`, and `sizeof()` /
  `alignment()` accept `Array` subclasses. `_align_` and the `align` option
  accept `number | boolean | bigint`.

### Changed

- **C++ modernization** (no behavior change): mutexes held for a whole scope
  use `std::scoped_lock` (`std::unique_lock` only where a condition variable
  waits), parameters unused on some platforms are `[[maybe_unused]]` instead
  of `(void)` casts, and `napi_fast::Undefined()` checks the status of
  `napi_get_undefined()`.

## [2.16.0] - 2026-11-28

This release aligns node-ctypes with CPython 3.14 `ctypes` wherever the two
differed, also when that changes existing behavior. The remaining differences
are listed in [Python ctypes parity](guides/python.md#differences).

Although it is a minor version, code that relied on the 2.15 behaviors listed
under "Changed (breaking)" must be updated; each entry says how. The libffi
submodule moves to the v3.8.2 release (see "Dependencies").

### Dependencies

- **libffi 3.8.2**: the submodule moves from the v3.8.1 tag to the unmodified
  v3.8.2 release. The fixes node-ctypes can reach: AArch64 reserves enough
  stack for several large by-value structures mixed with 16-byte-aligned
  arguments
  ([GHSA-wc36-xxj4-cxh5](https://github.com/libffi/libffi/security/advisories/GHSA-wc36-xxj4-cxh5)),
  by-value aggregates aligned beyond the stack alignment (`_align_ = 32`) are
  passed correctly on x86-64, ARM and AArch64
  ([GHSA-rwpw-56v4-44r3](https://github.com/libffi/libffi/security/advisories/GHSA-rwpw-56v4-44r3)),
  the static-trampoline code table is immutable after `fork()`
  ([GHSA-7qx4-vhpx-x6qm](https://github.com/libffi/libffi/security/advisories/GHSA-7qx4-vhpx-x6qm)),
  and oversized signatures are refused instead of truncated. New ABI tests
  cover both aggregate cases in calls, returns and callbacks. The generated
  headers report 3.8.2.

### Changed (breaking)

- **Executor teardown**:
  - `worker.terminate()` and environment teardown now always wait for the
    running `callOn()` call (join) instead of detaching its thread. Queued
    calls are still discarded. A native call that never returns now blocks
    `terminate()`. Detaching could free worker Buffers, callback closures and
    libffi state under a running call and crash the whole process.
- **Asynchronous calls**:
  - `callAsync()` and `callOn()` never throw synchronously: argument
    conversion errors (including `from_param` errors that mention
    "released"), arity and `paramflags` binding errors, a closed library and a
    released callback all reject the returned Promise. The decision no longer
    depends on the error message. Reading `fn.callAsync` / `fn.callOn` on a
    library attribute no longer binds the function (or resolves the symbol):
    binding errors reject the promise of the call.
- **Arguments**:
  - Extra arguments on Windows follow CPython: arguments past a non-empty
    `argtypes` are prepared with `ffi_prep_cif` (ordinary fixed arguments),
    as CPython 3.14 does there (its Windows build never defines
    `HAVE_FFI_PREP_CIF_VAR`, `Modules/_ctypes/callproc.c`); Linux and macOS
    keep `ffi_prep_cif_var`. Nothing changes on Windows x64. On Windows ARM64
    a non-variadic function whose `argtypes` omit trailing parameters now
    receives its `float`, `double` and floating-point structure arguments (the
    Koffi benchmark's `ImageDrawTextEx` without its final `Color` raised
    `exception: integer divide by zero`), while a genuinely variadic function
    such as `printf` no longer receives floating-point arguments past
    `argtypes`, as in CPython. Migration: declare all fixed parameters of a
    non-variadic function; for variadic floating-point calls on Windows ARM64
    use a non-variadic C wrapper. libffi's variadic AArch64 path for
    structures of floats or doubles
    ([libffi#1059](https://github.com/libffi/libffi/issues/1059)) is no longer
    reached on Windows.
  - Untyped and variadic arguments follow CPython: an integer Number/BigInt
    is passed as a C `int` when it fits C `long` or `unsigned long`
    (otherwise `ArgumentError` `OverflowError: int too long to convert`). A
    fractional Number, `NaN` or `Infinity` raises `ArgumentError`
    `TypeError: Don't know how to convert parameter N`. Pass `new c_double()` /
    `new c_int64()` / … explicitly for doubles and wide integers (previously
    inferred as double / int64).
  - A JS string passed to a `c_void_p` parameter is a NUL-terminated wide
    string (`wchar_t *`), as CPython's `c_void_p.from_param(str)`, in
    synchronous calls, `callAsync()` and `callOn()`; pass a Buffer for bytes
    (`char *`).
  - A JS string passed without `argtypes`, or beyond them (variadic
    arguments), is a NUL-terminated wide string (`wchar_t *`: UTF-16 on
    Windows, UTF-32 on Linux and macOS), as CPython passes a `str`; it was a
    UTF-8 `char *`. A string containing a NUL character raises `ArgumentError`
    `argument N: ValueError: embedded null character` instead of being
    truncated. A `char *` needs bytes, as in CPython: a NUL-terminated
    Buffer, a `c_char_p` instance or `create_string_buffer()`. Declared
    `c_char_p` / `c_wchar_p` parameters are unchanged. Migration:

    ```js
    const printf = libc.func("printf", c_int, [c_char_p]);
    printf("%s\n", "text"); // before: text; now: t (a wchar_t * read as char *)
    printf("%s\n", new c_char_p("text")); // now (also in CPython: b"text")
    printf("%s\n", Buffer.from("text\0")); // or bytes in a Buffer
    ```

  - A `Structure` / `Union` instance passed without `argtypes`, or beyond
    them (variadic arguments), is passed by value with its exact layout
    (bit fields, packing, byte order), as CPython does; it was passed by
    address. Arrays are still passed as pointers. Also in `callAsync()`,
    `callOn()` and prototypes. Migration, for a function that takes a pointer
    to the structure:

    ```js
    lib.GetCursorPos(pt); // before: passed &pt; now: passes the structure by value (as CPython)
    lib.GetCursorPos(byref(pt)); // pass the address
    ```

  - `c_void_p` parameters reject non-pointer SimpleCData instances (`c_int`,
    `c_double`, …) and structure/union instances with `ArgumentError`
    `'X' object cannot be interpreted as ctypes.c_void_p` (pass `byref(x)`).
    Migration, for a `c_void_p` parameter that receives a structure:

    ```js
    GetCursorPos.argtypes = [c_void_p];
    const pt = new POINT();
    GetCursorPos(pt); // before: passed &pt; now: ArgumentError
    GetCursorPos(byref(pt)); // now (also in CPython): passes &pt
    // or declare the parameter type: argtypes = [POINTER(POINT)], then GetCursorPos(pt)
    ```

  - `POINTER(T)` parameters reject integer addresses (Number or BigInt) in
    synchronous calls, `callAsync()`, `callOn()` and prototypes, as CPython
    does (`ArgumentError`
    `argument N: TypeError: expected LP_T instance instead of int`). Wrap the
    address with `cast(address, POINTER(T))`, or declare the parameter as
    `c_void_p`.
  - `c_char_p` / `c_wchar_p` parameters reject integer addresses
    (`ArgumentError` `'int' object cannot be interpreted as ctypes.c_char_p`),
    `byref()`, and buffers of the other character width; `c_wchar_p` rejects
    plain Buffers. `POINTER(T)` accepts a `create_string_buffer()` only when
    `T` is `c_char`, a `create_unicode_buffer()` only when `T` is `c_wchar`,
    and never `byref()` of them. Error messages name the value
    (`c_char_Array_7`, `CArgObject`, `bytes`).
  - `c_int64` / `c_uint64` / `c_size_t` / `c_ssize_t` arguments reject `null`
    (`'null' object cannot be interpreted as an integer`), as CPython rejects
    `None`.
  - A ctypes instance of another type given to a declared integer, float or
    character parameter raises CPython's messages
    (`argument 1: TypeError: 'c_double' object cannot be interpreted as an integer`,
    `must be real number, not c_int32`,
    `'c_int32' object cannot be interpreted as ctypes.c_char_p`) instead of
    `incompatible types, X instance instead of Y instance`. Structure, union,
    array and pointer instances given to a scalar parameter (also `c_int64`)
    raise `ArgumentError` instead of being passed as their address. A plain
    Buffer for a 64-bit integer parameter is still passed as its address
    (Node extension).
  - `c_char` parameters accept a BigInt `0n`..`255n`; other integers raise
    `ArgumentError` `TypeError: integer not in range(256)`, as CPython.
  - A parameter declared as a `c_void_p` subclass rejects a plain `c_void_p`
    instance (`'c_void_p' object cannot be interpreted as ctypes.c_void_p`),
    as CPython.
  - A `CFUNCTYPE` / `WINFUNCTYPE` parameter takes only an instance of a
    prototype (a callback or a function pointer), as CPython: data instances
    (`c_int32`, structures, arrays, pointers), integers and `null` raise
    `ArgumentError` `expected CFunctionType instance instead of c_int32`
    instead of passing their address as a function pointer, and so does a
    library function (`instead of _FuncPtr`): pass `cast(lib.fn, Prototype)`
    or `Prototype(address)`.
  - Too few arguments raise `TypeError`
    `this function takes at least 3 arguments (1 given)`, CPython's message
    (was `Expected 3 arguments, got 1`), also for COM methods.
  - `paramflags` binding follows CPython: extra positional arguments,
    unknown keyword keys and keys naming an out parameter raise `TypeError`
    `call takes exactly N arguments (M given)`; a missing input raises
    `required argument 'x' missing`. A plain-object struct value, an
    `_as_parameter_` object or a callback wrapper passed positionally is no
    longer read as keywords, and is never silently replaced by the default.
    An `inout` pointer parameter rejects `0` / `0n` with `ArgumentError`.
  - `paramflags` directions follow CPython's `_validate_paramflags` /
    `_build_callargs`. `inout` works with any argtype and a rejected value
    raises the argtype's own error
    (`argument 3: TypeError: expected LP_c_int32 instance instead of int`, was
    `expected POINTER(c_int32) instance instead of number`). `out` also works
    with array argtypes; another non-pointer argtype raises `TypeError`
    `'out' parameter N must be a pointer type, not X` (was
    `paramflags[i] is "out" but argtype i is not a POINTER(T)`). `out` on
    `c_void_p` / `c_char_p` / `c_wchar_p` (and subclasses) is accepted when
    the function is created (it was rejected), and a call without a default
    raises `TypeError`
    `c_void_p 'out' parameter must be passed as default value`. An `out` default (`[2, name, default]`) is passed to C and returned
    through `__ctypes_from_outparam__` (a `c_int32` default returns its value,
    a pointer default the same pointer object) instead of being ignored for a
    new instance; a default that is not C data (`null`, `byref()`) raises
    `AttributeError`
    `'NoneType' object has no attribute '__ctypes_from_outparam__'` after the
    arguments are converted (their `ArgumentError` comes first), without
    making the call. Errors are raised in parameter order. Flags `4`, `6` and `7` are
    rejected when the function is created (`TypeError`
    `paramflag value 4 not supported`), an `in | lcid` (`5`) parameter takes
    its default (or `0`) without consuming an argument, a malformed item
    raises `TypeError`
    `paramflags must be a sequence of (int [,string [,value]]) tuples`, and a
    length mismatch `RangeError`
    `paramflags must have the same length as argtypes` (CPython `ValueError`).
  - A parameter declared as a `Structure` / `Union` class rejects raw memory
    (Buffer, TypedArray, DataView, ArrayBuffer), other C data and functions
    with `ArgumentError`
    `argument N: TypeError: expected Point instance instead of bytes`, in
    synchronous calls, `callAsync()` and `callOn()`, as CPython does. An
    instance of the class (or a subclass), a plain object of field values
    and a `struct()` / `union()` instance (Node extensions) are still
    accepted.
  - Argument error messages name Python types: `str`, `list`, `dict`,
    `function` instead of `string`, `Array`, `object`, `Function`.
  - Subclasses of `c_long` / `c_ulong` (and `DWORD` / `LONG` / `ULONG` /
    `HRESULT` subclasses) no longer inherit the `c_int` / `c_uint`
    equivalence: a subclass is its own class in arguments, `from_param` and
    `POINTER` checks, as in CPython.
- **Scalars**:
  - The `c_void_p` constructor, `.value` and struct fields accept only
    integer/BigInt addresses (masked to pointer width), booleans and `null`,
    as CPython. Buffers, pointers, `c_char_p` / `c_wchar_p` / `c_void_p`
    instances, strings and `_as_parameter_` objects raise `TypeError`: use
    `addressof()` or `cast(buf, c_void_p)`. `POINTER(c_void_p)` element
    writes (`p[0] = x`) take the same values and also a `c_void_p` instance,
    whose address is copied and whose owner is kept alive (CPython); a
    `c_char_p` / `c_wchar_p` instance raises `TypeError`.
  - `c_char_p.from_param()` / `c_wchar_p.from_param()` reject integers,
    BigInts, booleans and floats
    (`'int' object cannot be interpreted as ctypes.c_char_p`) instead of
    returning an instance at that address. `c_void_p.from_param(true)`
    returns the address 1, as CPython.
  - `c_char_p` and `c_wchar_p` constructors and fields: a plain Buffer
    assigned to `c_char_p` is copied with a NUL terminator (Python `bytes`).
    `create_string_buffer()` / `create_unicode_buffer()`, other ctypes arrays
    and `byref()` views raise `TypeError`; `c_wchar_p` rejects every Buffer.
    Unsupported values (`{}`, `1.5`, …) raise `TypeError` instead of writing
    NULL. Negative and oversized BigInt addresses are masked like Numbers,
    and booleans are accepted as 1/0.
  - Integer `_type_` codes follow the platform C type like CPython:
    `c_int` / `c_int32` is `"l"` and `c_uint32` is `"L"` where `long` is
    32-bit (Windows); `c_int64` / `c_longlong` / `c_long` is `"l"` and
    `c_uint64` / `c_size_t` is `"L"` where `long` is 64-bit.
  - `c_size_t` / `c_ssize_t` are the same classes as the fixed-width types of
    pointer size (`c_uint64` / `c_int64` on 64-bit), and on LP64 platforms
    `c_long` / `c_ulong` are `c_int64` / `c_uint64`, as in CPython.
  - `__ctype_be__` is undefined on `c_void_p`, `c_char_p`, `c_wchar_p` and
    `c_wchar` (typed as `undefined` there; numeric types keep a non-optional
    type). `c_long.__ctype_be__` is the variant of the C type of the same
    size, as in CPython: `c_int32_be`, which reads Numbers, where `long` is
    32-bit (Windows), `c_int64_be` (BigInt) on LP64; it is typed
    `number | bigint`. `c_bool.__ctype_be__` is a distinct `c_bool_be` class that
    stores and reads its byte as an integer, as CPython
    (`c_bool.__ctype_be__(5).value === 5`). Byte-swapped types are rejected
    by `from_param` of the native type. A subclass of a byte-swapped type
    (`class X extends c_int32.__ctype_be__ {}`) is native-order, as in
    CPython, and its `__ctype_be__` is a new `X_be` class (it kept the
    big-endian order of its base).
  - `c_bool` conversions use Python truth values: `NaN` is true, a NULL
    pointer instance is false, an empty array/Buffer/JS array is false, a
    SimpleCData instance is true when its bytes are not all zero, and a
    `c_bool` argument given an object uses that rule instead of JS
    truthiness and never reads its `_as_parameter_`
    (`{ _as_parameter_: false }` is true, as CPython). In mirror mode (no
    external buffers), `c_bool` reads the
    current native bytes of SimpleCData instances.
  - `String()` of an instance of a SimpleCData subclass is
    `<Sub object at 0x…>`, as CPython's `repr()` (it was `Sub(42)`); builtin
    types, byte-swapped types, `HRESULT` and `wintypes.VARIANT_BOOL` keep
    `Name(value)` (`c_int32(42)`).
- **Pointers**:
  - `POINTER(T)` returns a callable class (`typeof` `"function"`) instead of
    a plain object: `POINTER(T)()` is a NULL pointer, `POINTER(T)(obj)` /
    `new POINTER(T)(obj)` point to a ctypes instance,
    `p instanceof POINTER(T)` and `p.constructor === POINTER(T)` hold, and
    `.name` is `LP_<pointee>`. `create()` (including the Node extension
    `create(address)` with a Number or BigInt address), `fromBuffer()` and
    `fromAddress()` are unchanged (`create()` of another value raises
    `TypeError`
    `expected c_int32 instance, Buffer, address or null instead of str`);
    `LP(address)` raises `TypeError`, as in
    CPython. `String(POINTER(T))` names the pointee type
    (`"POINTER(c_int32)"`; previously its numeric type code, e.g.
    `"POINTER(5)"`).
  - `POINTER(T).create(x)` and `POINTER(T)(x)` accept any ctypes instance, as
    CPython 3.14 does, instead of only instances of `T`. A pointer argument
    is pointed at through its own slot
    (`addressof(LP(p).contents) == addressof(p)`) instead of having its
    address copied.
  - Assigning `.contents` re-points the pointer for any ctypes instance,
    including pointer instances of any pointee and instances smaller than the
    pointee. For `POINTER(POINTER(T))`, `POINTER(CFUNCTYPE)` and
    `POINTER(array)` bases, `null`, integers, Buffers and plain values raise
    `TypeError` instead of overwriting the pointed-to slot.
  - Buffer-backed pointers no longer read or write outside their memory:
    element access outside it throws `RangeError` instead of falling back to
    its address. The memory of a pointer to a raw Buffer (`pointer(buf)`,
    `cast(buf, POINTER(T))`, `create()` / `fromBuffer()` / `set()`) is that
    Buffer's own bytes, not its backing `ArrayBuffer`, which `Buffer.from()`,
    `Buffer.allocUnsafe()` and `Buffer.concat()` share with unrelated
    Buffers; instances over caller memory (`from_buffer()` of any Buffer,
    typed array or DataView, `ARRAY(T, n).wrap()`, `Structure.create(buf)`,
    `struct()` field views) stay inside it, and `p.add(n)` keeps a
    buffer-backed pointer inside its memory (`RangeError` past its end); a
    pointer into a ctypes instance's memory spans its whole allocation
    (`pointer(arr[0])[2]` and `cast(byref(a, 8), POINTER(c_int32))[-1]`
    work). An instance created with `from_buffer()` over a subview of other
    memory is bounded by that subview.
    `POINTER(T).create(buf)` and `POINTER(T).fromBuffer(buf)` reject a raw
    Buffer smaller than `sizeof(T)`.
  - A pointer read from a structure field or an array element is a live view
    of that slot, as in CPython: after `f = s.p; s.p = q`, `f` points to `q`'s
    target, and after `s.p = null` it is NULL (`f[0]` throws `RangeError`
    `NULL pointer access`). Previously it kept a snapshot of the old address.
    A pointee assigned to a field stays referenced after C clears the slot,
    while the structure is alive and the field is not reassigned (CPython
    `_objects`).
  - `POINTER(CFUNCTYPE)` slots accept only function-pointer objects: data
    pointers, integers and `null` raise `TypeError` as in CPython. Assigning
    `.contents` a function re-points the pointer.
  - `POINTER()` without an argument raises `TypeError` instead of returning
    `c_void_p`. `POINTER(null)` and `POINTER(undefined)` still return
    `c_void_p`.
  - `cast()` rejects target types that are not pointer types (`TypeError`
    `cast() argument 2 must be a pointer type, not X`), also for a NULL
    source, instead of reading memory at the address.
  - `string_at(addr)` without a size returns the bytes up to the NUL as a
    Latin1 string, like the sized form (Python `bytes`), instead of decoding
    UTF-8: use `Buffer.from(s, "latin1").toString("utf8")` for text.
  - `string_at` / `wstring_at`: size `-1` (the CPython default) is accepted
    by both, sizes are a C `int` as in CPython (Number or BigInt, modulo
    2\*\*32: `2 ** 32 + 2` is `2`, `2 ** 34` is `0`, `2n ** 64n - 1n` is
    `-1`; previously modulo 2\*\*64, so `string_at(16n, 2 ** 34)` threw
    `bad allocation`), a boolean size is 1/0, other non-integer sizes raise
    `ArgumentError`
    (`argument 2: TypeError: 'float' object cannot be interpreted as an integer`)
    instead of being truncated or ignored, and negative sizes other than `-1`
    (also `2 ** 31` to `2 ** 32 - 2`, CPython's `SystemError`)
    raise `RangeError`. A JS string source is read as a `wchar_t *` (CPython
    `str`), `wstring_at(null, 0)` is `""`, and a source that is not memory or
    an address raises `ArgumentError`
    (`argument 1: TypeError: 'float' object cannot be interpreted as ctypes.c_void_p`).
  - `memset()` takes the fill value modulo 256 (also a BigInt or a boolean);
    other values raise `ArgumentError`
    (`argument 2: TypeError: 'str' object cannot be interpreted as an integer`).
    `memmove()` accepts a JS string source (a `wchar_t *`). As their Python
    argtypes, `memset()` takes a `c_int` instance as fill value,
    `memset()` / `memmove()` a `c_size_t` instance as count and
    `string_at()` / `wstring_at()` a `c_int` instance as size (also through
    `_as_parameter_`); other C data, and a non-integer count, raise
    `ArgumentError`
    (`argument 3: TypeError: 'float' object cannot be interpreted as an integer`;
    a fractional count was a `RangeError`).
  - `cast()` masks integer sources to 64 bits (`cast(-1, c_void_p).value` is
    `2n ** 64n - 1n`), takes booleans as 1/0 and JS strings as `wchar_t *`,
    and rejects `NaN`, fractional numbers and JS arrays with `ArgumentError`
    (`'float' object cannot be interpreted as ctypes.c_void_p`); `NaN` was
    NULL. Simple C data other than `c_void_p` / `c_char_p` / `c_wchar_p` (also
    as `_as_parameter_`) is rejected the same way
    (`cast(new c_int(5), POINTER(c_int))`:
    `argument 1: TypeError: 'c_int32' object cannot be interpreted as ctypes.c_void_p`)
    instead of pointing to the instance.
  - `from_address()` (simple types, structures, unions, arrays and
    `POINTER(T)`) takes the address as CPython: an integer (`TypeError`
    `integer expected`), a negative one wrapped (`from_address(-1)` is at
    `2n ** 64n - 1n`), out of the pointer range `RangeError`
    `int too big to convert`. Address 0 throws `TypeError`
    `from_address: NULL address` for every type (it made a broken instance
    or an unrelated pointer).
  - `addressof()` rejects Numbers and BigInts
    (`addressof() argument must be _ctypes._CData, not int`) and accepts
    function pointers, as do `byref(f)` and `POINTER(T)(f)`. `pointer(5)`,
    `pointer(byref(x))` and `byref(byref(x))` raise `TypeError`
    (`<class 'int'> must have storage info`), and `POINTER({})`,
    `POINTER(5)` and `POINTER(instance)` raise `TypeError`
    `'dict' object has no attribute '__name__'` (CPython `AttributeError`).
    A class that is not a ctypes type (`POINTER(Number)`,
    `POINTER(class X {})`) raises `TypeError`
    `<class 'X'> must have storage info`, as CPython's `POINTER(int)`, instead
    of being taken as a thunk: a thunk is an arrow function or another
    function that is not a class or a builtin (`POINTER(() => T)`).
    `POINTER("Name")` is CPython's incomplete pointer type (see Added).
  - A subclass of a pointer type without its own `_type_`
    (`class A extends POINTER(c_ulong) {}`) cannot be instantiated: `TypeError`
    `Cannot create instance: has no _type_`, as in CPython (it created an
    `LP_c_ulong`).
  - `delete p[i]` and `delete p.contents` throw `TypeError`
    `Pointer does not support item deletion`, as in CPython (they were
    silently ignored).
  - `from_buffer()` / `from_buffer_copy()` errors use CPython's messages,
    without the `from_buffer:` prefix: `RangeError`
    `offset cannot be negative` and
    `Buffer size too small (2 instead of at least 4 bytes)`, `TypeError`
    `memoryview: a bytes-like object is required, not 'int'`
    (`from_buffer`) and `a bytes-like object is required, not 'int'`
    (`from_buffer_copy`).
  - `writeValue(buf, StructClass, value)` with a value that is not an
    instance throws `TypeError` `expected S instance, got bytes` (a Buffer
    was copied as bytes; `null` and numbers were ignored). `in_dll()` of a
    missing symbol throws `RangeError` `symbol 'x' not found` (CPython's
    `ValueError` text); a name that is not a string throws `TypeError`
    `in_dll() argument 2 must be str, not int` (a number was looked up as an
    ordinal), one with a NUL `RangeError` `embedded null character`.
- **Structures, unions and arrays**:
  - `Union` is no longer a subclass of `Structure` (CPython parity):
    `unionInstance instanceof Structure` is now false. Both classes derive
    from a shared internal base.
  - `new S(buffer)` no longer wraps the Buffer: like CPython it is a
    positional initializer of the first field (for example `S(b'abcd')`
    copies into a `c_char * 4` field). Use `S.from_buffer(buf)` or
    `S.create(buf)` to view existing memory.
  - Nested Structure/Union fields and struct array elements accept only an
    instance of the field type, a tuple (JS Array) or a plain object of field
    values (Node extension). Raw Buffers, ctypes arrays, scalars and other
    values throw `TypeError` with CPython messages instead of being copied as
    raw bytes.
  - Array fields and elements of arrays of arrays accept only the same array
    type (including byte order) or a tuple. Raw Buffers, Structure instances
    and arrays of another element type or byte order throw `TypeError`.
  - A `c_char * n` field, its initializer and the `.value` of a `c_char`
    array take bytes (a Buffer or a `Uint8Array`) or a string, as CPython.
    Array instances, `create_string_buffer()`, other typed arrays, `DataView`,
    JS arrays, numbers and `null` throw `TypeError`
    (`expected bytes, Int16Array found`; for `.value`
    `bytes expected instead of Int16Array instance`) instead of being written
    as decimal text (`"1,2"`). `.raw` takes any typed array or `DataView` as
    bytes and rejects other values
    (`a bytes-like object is required, not 'list'`). A `c_wchar * n` field
    and the `.value` of a `c_wchar` array take only a string
    (`unicode string expected instead of int instance`) instead of converting
    other values with `String()`. A `c_char * n` field stores the bytes up to
    the first NUL, plus a NUL when there is room (CPython `strlen`). The
    `.value` setter of a `c_char` array rejects ctypes instances and
    `byref()` (`bytes expected instead of _ctypes.CArgObject instance`);
    `.raw` takes the memory of a ctypes instance and rejects `byref()`
    (`a bytes-like object is required, not '_ctypes.CArgObject'`).
  - `create_unicode_buffer().value` takes only a string
    (`unicode string expected instead of bytes instance`).
  - `create_string_buffer()` / `create_unicode_buffer()` check `init` and
    `size` as CPython: a negative size throws `RangeError`
    `Array length must be >= 0, not -1`, a non-integer size `TypeError`
    `can't multiply sequence by non-int of type 'float'`, a `null` size is
    the computed one, an integer `init` ignores `size`, and an unsupported
    `init` throws `TypeError`. The `.value` / `.raw` setters of
    `create_string_buffer()` throw `TypeError`
    `bytes expected instead of int instance` /
    `a bytes-like object is required, not 'int'`.
  - `_fields_` is validated as CPython: a malformed entry throws `RangeError`
    `_fields_ must be a sequence of (name, C type) pairs or (name, C type, bit size) triples`
    (was `TypeError`), a ctypes instance as type `TypeError`
    `type of field 'a' must be a C type`, a non-type value such as `5`
    `TypeError` `this type has no size`, and `_fields_` `null` / `5`
    `TypeError` `'NoneType' object is not iterable` /
    `'int' object is not iterable`. A bad `_pack_` throws `RangeError`
    (`_pack_ must be a non-negative integer`), a non-number `_align_`
    `TypeError`; the layout attributes are checked before the fields, and a
    byte-swapped structure checks the byte order of every field first.
    Bit-field widths accept BigInts and booleans; a non-integer width throws
    `TypeError` `an integer is required`. A bit field of an explicitly
    swapped type (`c_uint16.__ctype_be__`) keeps its byte order.
  - `_fields_ is final` is an `AttributeError`, as in CPython (was
    `TypeError`). A class is final after `S._fields_ = [...]` and after its
    first use (instantiation, `from_buffer()` and the other factories, use as
    a field type), and materializing a subclass finalizes its bases (a
    later `Base._fields_ = [...]` throws; it was accepted). As CPython,
    `sizeof()` of a class without `_fields_` does not finalize it. A class
    declared with `static _fields_` is finalized when it is first used.
  - A class that declares `_abstract_` (`static _abstract_ = true`; any
    value, as in CPython) cannot be used: construction,
    `from_buffer()`, `from_buffer_copy()`, `from_address()` and `in_dll()`
    throw `TypeError` `abstract class`, as in CPython (it was instantiable).
    So do the `Structure`, `Union` and `SimpleCData` bases themselves
    (`Structure.from_buffer(buf)` returned an instance;
    `SimpleCData.from_param(42)` threw an unrelated error).
  - A structure or union that contains itself (`R._fields_ = [["r", R]]`)
    throws `AttributeError` `Structure or union cannot contain itself` when
    it is materialized, instead of `RangeError`
    `Maximum call stack size exceeded`.
  - `_anonymous_` must be a sequence (`TypeError`
    `_anonymous_ must be a sequence` for `_anonymous_ = 42`, which was
    accepted); a string is the sequence of its characters, as in CPython.
  - An array type larger than `Number.MAX_SAFE_INTEGER` (2\*\*53 - 1) bytes
    throws `RangeError` `array too large` (CPython `OverflowError`), instead of
    reporting an inexact size.
  - `delete arr.value` of a ctypes `c_char` / `c_wchar` array throws
    `TypeError` `can't delete attribute` and `delete arr.raw` `TypeError`
    `cannot delete attribute` (CPython `AttributeError`), instead of being
    silently ignored.
  - `struct()` / `union()` `get()` / `set()` of an unknown field throw
    `AttributeError` `Unknown field: x` (was `Error`).
  - The `CField.type` of a function-pointer field is the prototype itself.
  - Array constructors with more initializers than elements, and element
    writes outside the array (negative indexes included), throw `RangeError`
    `invalid index` (CPython `IndexError` with the same message; CPython wraps
    a negative index).
  - Byte-swapped array types are named after the swapped element type, as in
    CPython: an array field of a `BigEndianStructure` is `c_int32_be_Array_3`
    on a little-endian host, so `incompatible types` errors tell the two
    apart. Its `_type_` is the swapped element type (`c_int32_be`), and the
    field accepts instances of the swapped array type.
  - A `CFUNCTYPE` field rejects `null` (`TypeError`
    `expected CFunctionType instance, got NoneType`), as in CPython.
  - `POINTER(T)` struct/union fields, `POINTER` array elements and `pp[i]`
    reject Numbers, BigInts, Buffers, `byref()` and objects with
    `_as_parameter_` (`TypeError` `expected LP_T instance, got CArgObject`),
    with Python type names (`int`, `bool`, `dict`). Function-pointer fields
    reject data pointers and integers.
  - `BigEndianStructure` / `BigEndianUnion`, and `struct()` / `union()` with
    `swapped: true`, reject field types without a big-endian form (pointers,
    `CFUNCTYPE`, `c_void_p`, `c_char_p`, `c_wchar_p`, `c_wchar`, arrays of
    these, and custom types without big-endian accessors): `TypeError`
    `This type does not support other endian: <class 'ctypes.c_void_p'>`.
  - A field promoted through `_anonymous_` replaces an outer field of the
    same name (CPython `MakeAnonFields` semantics), both on the class and on
    instances; the fields are promoted in `_anonymous_` order (the last listed
    field wins a name, it was the last declared one), and fields of
    nested anonymous structures are not class attributes of the outer class.
    An `_anonymous_` field that is not a structure or union throws
    `AttributeError` `type object 'c_int32' has no attribute '_fields_'`
    (was `TypeError`), also when an earlier promotion replaced it with a
    field of a simple type.
  - Layout `ValueError` cases throw `RangeError` with CPython messages:
    unknown `_layout_`, `_pack_` with `gcc-sysv`, invalid bit-field width
    (`number of bits invalid for bit field ...`).
  - Native `StructType` / `ArrayType`: memory given for a nested struct
    field, a struct array element or a whole array must be exactly the
    aggregate size; shorter or longer Buffers/views throw `TypeError`
    (`<what> requires exactly N bytes, got M`) instead of being partially
    copied, zero-filled or truncated.
  - Removed the undocumented `Structure.createRaw`, `struct().createRaw`,
    `Structure.createArray`, `Structure.updateArray` and the instance
    methods `getFloat64Array`, `getInt32Array`, `getBufferSlice`,
    `setFields`, `syncFromObject` and `withBulkUpdate` (also on `Union`
    instances where they existed). Use field assignment, `from_buffer()` /
    `from_buffer_copy()` and arrays of structures (`array(Point, n)`) instead.
- **Libraries and functions**:
  - The `.pointer` of a released `callback()` / `threadSafeCallback()` throws
    `Callback has been released` / `ThreadSafeCallback has been released`
    (it returned the freed trampoline address), and passing a released
    callback, or a `CFUNCTYPE` instance over it, as an argument throws instead
    of passing that address. Migration: read `.pointer` before `release()`
    only if the C side no longer uses it, or keep the callback alive.
  - `CDLL` / `WinDLL` / `OleDLL` attribute access looks the symbol up, as
    CPython does: a missing export throws `AttributeError` on access, not at
    the first call, with CPython's message: `function 'name' not found` on
    Windows, the `dlerror()` text on Linux and macOS.
    `name in lib` is true for resolvable exports. Dunder names and JS protocol
    probes (`then`, `toJSON`, `asymmetricMatch`, `$$typeof`, `nodeType`,
    `inspect`, module interop `__esModule` / `default`, Vue `__v_isRef` /
    `__v_skip` / …) return `undefined`.
  - `CDLL._name` is the name given to the constructor (`null` for
    `CDLL(null)` and `CDLL(null, { handle })`), and `_handle` no longer
    changes after `close()`.
  - On Windows, `CDLL(null)` / `WinDLL(null)` / `OleDLL(null)` without a
    `handle` throw `TypeError`
    `LoadLibrary() argument 1 must be str, not None`, as CPython does (they
    opened the main executable). Linux and macOS still open the program.
    `CDLL("")` throws `Error` `[WinError 87] <system text>` (`winerror` 87)
    on Windows, as CPython (it loaded the main executable too), and a
    library that cannot be found throws CPython's message
    `Could not find module 'x.dll' (or one of its dependencies). Try using the full path with constructor syntax.`
    with `errno` 2.
  - `fn.argtypes` / `fn.restype` assignments are validated with CPython's
    messages (`item 1 in _argtypes_ has no from_param method`,
    `_argtypes_ must be a sequence of types`,
    `restype must be a type, a callable, or None`), and a failed assignment
    keeps the previous value. `CType` numbers are still accepted (Node API).
    Assigning `errcheck` a value that is not a function or `null` throws
    `TypeError` `the errcheck attribute must be callable` (was
    `errcheck must be a function or null`). An `errcheck` that returns its
    own `args` array returns the call result, as CPython's `_build_result`,
    instead of the array.
  - Assigning `restype` or `argtypes` on a function returned by `CDLL.func()`,
    on a `CFUNCTYPE` / `WINFUNCTYPE` instance or on a `paramflags` function
    throws `TypeError` (it was silently ignored). They are readable getters;
    use the library attribute or a prototype with the new signature. CPython
    lets a function pointer instance change them: see
    [Python ctypes parity](guides/python.md#differences).
  - `OleDLL` functions check the `HRESULT` whatever their ctypes `restype`
    (CPython `FUNCFLAG_HRESULT`): after `fn.restype = c_int32`, a negative
    result still raises `[WinError N]`, and a result that is not an integer
    (`c_double`, a structure, a pointer) raises `TypeError` with CPython's
    type name (`'float' object cannot be interpreted as an integer`; `bytes`,
    `str`, the array type name, `LP_c_int32` / `CFunctionType` for a NULL
    pointer or function pointer rather than `NoneType`). A `c_bool` result is
    checked and returned as `0` / `1`, and a result of a SimpleCData
    subclass restype raises `TypeError` naming the class
    (`'MyInt' object cannot be interpreted as an integer`). A plain JS
    function `restype` is not a ctypes type: its result is returned unchecked,
    as in CPython. A restype class with its own `_check_retval_` replaces the
    HRESULT check, as in CPython.
  - `lib.get_last_error()` / `lib.get_errno()` return the thread's
    ctypes-private copy, the same value as `get_last_error()` /
    `get_errno()`, not a per-library value. As in 2.x they throw `Error`
    `Library was not opened with use_last_error: true` (`use_errno: true`)
    when the library was opened without that flag.
  - `prototype([name, lib])` and `prototype([name, lib], paramflags)` no
    longer inherit the library's `use_errno` / `use_last_error`; only the
    prototype's own flags apply, as in CPython.
  - `CFUNCTYPE` / `WINFUNCTYPE` factories validate their arguments like
    CPython: `(int, non-str)` raises `argument 2 must be str, not ...`, bad
    `paramflags` raise `paramflags must be a tuple or None`, a function with
    extra arguments raises `TypeError`, and BigInt or negative COM indexes are
    accepted.
  - At most 1024 arguments, as CPython's `CTYPES_MAX_ARGCOUNT`: more
    `argtypes` raise `ArgumentError`
    `_argtypes_ has too many arguments (1025), maximum is 1024` when the
    prototype is created or `argtypes` is assigned, and a call with more
    arguments `ArgumentError` `too many arguments (1025), maximum is 1024`
    (`callAsync()` / `callOn()` reject); they were accepted. A COM method
    prototype with 1024 `argtypes` fails when it is created (its `this`
    makes 1025), where CPython fails at the call.
  - COM method prototypes (`prototype(vtblIndex, name[, paramflags[, iid]])`)
    are Windows-only, as in CPython. The first argument must be a ctypes
    instance whose first pointer is the interface pointer (`pointer(obj)`,
    `c_void_p`, a Structure, `create_string_buffer()`). Numbers, BigInts,
    `null` and `byref()` raise `TypeError` instead of being used as raw
    addresses, and a Structure or Buffer `this` now means the pointer it
    holds, not its own address.
  - `callback()`, `threadSafeCallback()` and `CFUNCTYPE` callbacks raise
    `TypeError('invalid result type for callback function')` when the
    restype is a plain JS function or class that is not a ctypes type, or a
    `POINTER(T)` / `CFUNCTYPE` type (CPython has no setfunc for them; C would
    get memory nothing keeps alive): return `c_void_p` and an address. A
    callable restype is still supported for foreign functions.
  - Callback results for `c_char_p`, `c_wchar_p` and `c_void_p` restypes
    (also the raw `CType.STRING` / `CType.WSTRING` / `CType.POINTER`) follow
    CPython's setfunc: `null`, an integer address, a boolean, a JS string
    (`c_char_p` / `c_wchar_p`) or, for `c_char_p`, a Buffer, which is copied
    and kept for the process lifetime with a
    `RuntimeWarning: memory leak in callback function.`. TypedArrays,
    DataViews, `create_string_buffer()` and other ctypes instances raise
    `TypeError` (`bytes or integer address expected instead of X instance`)
    instead of passing the address of memory the garbage collector can
    free; so does `byref()`, and messages use Python type names
    (`_ctypes.CArgObject`).
  - A callback that returns a C-data instance for a numeric result raises
    `TypeError` (`'c_int32' object cannot be interpreted as an integer`,
    `must be real number, not c_int32`), reported as unraisable with the
    result `0`, as CPython; a `c_bool` result still uses the truth value.
  - A callback argument declared as a `CFUNCTYPE` prototype is a callable
    instance of that prototype (was a BigInt address).
  - Prototype instances (callbacks, `Prototype(address)`, `cast(x, P)`) are
    `instanceof Prototype` with `x.constructor === Prototype`; the prototype
    class is named `CFunctionType` (arrays of it `CFunctionType_Array_N`).
  - `CFUNCTYPE` / `WINFUNCTYPE` callbacks with `use_errno` / `use_last_error`
    swap `errno` / the last error with the ctypes-private slot around the
    JavaScript function, as CPython's `_CallPythonObject`. On entry, C code
    called by the callback sees the private value in `errno` /
    `GetLastError()`, while `get_errno()` / `get_last_error()` return the
    value the C caller had set. On exit the two are swapped back: a value
    stored with `set_errno()` / `set_last_error()` in the callback is what the
    C caller sees in `errno` / `GetLastError()`.
  - On Windows, importing node-ctypes loads `kernel32.dll` and reads the
    thread's last error once, so that the first `GetLastError()` /
    `WinError()` call does not overwrite it with its own lazy setup.
- **Errors and platform**:
  - `GetLastError()` and `SetLastError()` read and write the system thread
    error (kernel32), as `ctypes.GetLastError` does, and are Windows-only
    (they throw elsewhere). Use `get_last_error()` / `set_last_error()` for
    the private ctypes slot. `SetLastError()` returns `undefined`.
  - The last error is a signed C `int`, as in CPython: `GetLastError()`,
    `get_last_error()` and `lib.get_last_error()` read `0x80070005` as
    `-2147024891` (was `2147942405`) and `0xdeadbeef` as `-559038737`.
  - `set_errno(v)` / `set_last_error(v)` check their argument as CPython:
    exactly one argument (`TypeError`
    `function takes exactly 1 argument (N given)`), an integer Number, BigInt
    or boolean in the C `int` range. Out of range is a `RangeError`
    (`Python int too large to convert to C long` on Windows;
    `signed integer is greater than maximum` /
    `signed integer is less than minimum` elsewhere), a non-integer a
    `TypeError` (`'float' object cannot be interpreted as an integer`);
    values were silently wrapped or truncated and a missing argument ignored.
    Both still return the previous value. Pass an HRESULT-style code signed:
    `set_last_error(0x80070005 | 0)`.
  - `WinError()` and `FormatError()` with no code use the system
    `GetLastError()` instead of the private ctypes slot, read signed: an
    HRESULT-style last error works (after `SetLastError(0x80070005)`,
    `WinError().winerror` is `-2147024891` and its `errno` `13`).
  - `WinError(code)` / `FormatError(code)` read the code as a C `long`, as
    CPython: a code outside the signed 32-bit range (an unsigned `HRESULT`
    such as `0x8000500d`) raises `RangeError`
    `Python int too large to convert to C long` instead of formatting
    `[WinError 2147504141]`; pass the signed value (`0x8000500d | 0`).
    `FormatError()` rejects a fractional code with `TypeError`, and `null`
    with `TypeError` `'NoneType' object cannot be interpreted as an integer`.
    As in CPython, `FormatError(0)` formats `GetLastError()`, `WinError(0)`
    keeps `winerror` `0` with the text of `GetLastError()`, and the
    `filename` of a `WinError(n)` is `null`.
  - A negative `HRESULT` raises an error shaped like CPython's `OSError`:
    message `[WinError <signed>] <system text>`, `strerror` is the
    FormatMessage text without trailing dots (or `Windows Error 0x%x`), with
    `errno`, `filename` `null` and signed `winerror` / `hresult`. The former
    `<Loader> name failed with HRESULT 0x..` text is in `error.function`.
  - `find_library()` on Windows matches CPython 3.14: it searches `PATH`
    only and returns the full path found, or `null`. `find_library('c' / 'm'
/ 'ssl' / 'crypt')` returns `null`; the `msvcrt` / `schannel` /
    `advapi32` aliases were removed. A missing library returns `null` on
    every platform.
- **Conversion errors and `from_param`** (CPython 3.14):
  - A `from_param` result for a `POINTER(T)`, array or `c_void_p` parameter
    is passed without the argument type check, as CPython: an integer is the
    address, `null` NULL, a JS string a `wchar_t *` (a UTF-8 `char *` for a
    `POINTER(c_char)` parameter), an instance, `byref()`, a Buffer or an
    `_as_parameter_` object its address or value; other results raise
    `ArgumentError`
    `argument N: TypeError: Don't know how to convert parameter N`, and an
    integer that does not fit a pointer `ArgumentError`
    `argument N: OverflowError: int too long to convert` (it was passed as
    NULL).
  - Error messages name rejected values with Python type names: `NoneType`,
    `int`, `float`, `str`, `bool`, `list`, `dict`, `bytes`, `function`,
    `CFunctionType` / `_FuncPtr` for function pointers, the ctypes type for
    C data (previously `null`, `number`, `string`, `Array`, `Object`,
    `Buffer`, `Uint8Array`, `Function`, …): argument conversions, struct /
    union / array field and element assignments (`expected P instance, got
int`), `from_param`, SimpleCData constructors (`not bytes of length 2`;
    `new c_wchar(1.5)`: `a unicode character expected, not instance of float`).
    Array parameters are named `c_int32_Array_3` (was `c_int32 * 3`), and
    `byref()` of another type `pointer to c_float`.
    - `c_wchar` takes only a one-character string, as CPython: a number (a code
      point) is a `TypeError` `a unicode character expected, not instance of int`
      in the constructor, `.value`, `from_param`, struct / union fields, array
      elements and `POINTER(c_wchar)` items, an `ArgumentError` for `c_wchar`
      parameters (sync and async) and an unraisable error for a callback result.
      Migration: `new c_wchar(0x4e2d)` becomes `new c_wchar("中")` (or
      `String.fromCodePoint(0x4e2d)`).
  - Too many initializers for an array field or element
    (`S({ arr: [1, 2, 3, 4] })`, `s.arr = [...]`, `ARRAY(Int3, 2)([1, 2, 3, 4])`)
    raise `RangeError` `invalid index`, as the other array paths (was
    `Array too long (4, maximum length 3)`).
  - `ARRAY(T, n).from_param()` and array parameters accept `byref()` of a `T`
    instance and a `create_string_buffer()` / `create_unicode_buffer()` of the
    same element type and length; `byref()` of another type and a character
    buffer of another kind or length are rejected (were passed as raw memory).
  - `POINTER(c_char)` / `POINTER(c_wchar)` convert as `c_char_p` /
    `c_wchar_p.from_param` (CPython binds them): `from_param` accepts bytes and
    `c_char_p` instances, and a `c_char` / `c_wchar` instance (not `byref()`
    of one) is rejected, also as an argument, with
    `'c_char' object cannot be interpreted as ctypes.c_char_p`.
    `c_char_p` / `c_wchar_p` accept `byref()` of a `c_char` / `c_wchar`.
    A JS string given to a `POINTER(c_char)` parameter is passed as a
    NUL-terminated UTF-8 `char *` (it was a `wchar_t *`), as for `c_char_p`
    (CPython raises `TypeError`), and an `_as_parameter_` of `null` is NULL.
  - `POINTER(T).from_param()` and `ARRAY(T, n).from_param()` resolve
    `_as_parameter_` as CPython's `CDataType_from_param`: only an instance or a
    `byref()` of a `T` instance is accepted through it (an array is rejected).
  - `c_void_p.from_param()` accepts function pointers (CFUNCTYPE instances,
    library functions). Integer, float and character parameters reject
    function pointers (`'CFunctionType' object cannot be interpreted as an
integer`) instead of passing their address.
  - `wintypes.VARIANT_BOOL` has no `__ctype_be__` / `__ctype_le__` (now
    `undefined`) and is rejected in a `BigEndianStructure`, as CPython.
- **Typings**:
  - `callback()` / `threadSafeCallback()` no longer accept `POINTER(T)` or
    `CFUNCTYPE` restypes, and a `c_char_p` / `c_wchar_p` / `c_void_p`
    callback is typed to return what the runtime accepts (a string, a Buffer
    for `c_char_p`, an integer address, a boolean or `null`), not a ctypes
    instance.
  - `wintypes.VARIANT_BOOL.__ctype_be__` / `__ctype_le__` are typed
    `undefined`.
  - Field, element and parameter types follow the runtime setters:
    `POINTER(T)` fields, array elements and `p.contents` of a pointer to a
    pointer take a pointer of the pointee type (`p.contents` no `null`),
    fields and elements also an array or `null`, not a BigInt address, a
    Buffer or a `{ _buffer }` object; `CFUNCTYPE` fields and elements take an
    instance of the prototype, not `null` or an address; nested `struct()`
    fields and parameters take the definition's field values (unknown keys
    are errors), a tuple or a `create()` result, not `{ _buffer }`; nested
    Structure-class fields and elements take an instance, field values or a
    tuple, not a Buffer; numeric array fields take a tuple or an array
    instance, not a Buffer; `c_char` array fields take bytes or a string, not
    a JS array; `c_wchar` array fields only a string; bit fields a Number or
    BigInt. `POINTER(T)` parameters no longer accept a Number or BigInt
    address. `POINTER(T).create(address)`, `P()` (NULL function pointer) and
    BigInt values for `set_errno()` / `set_last_error()` are typed.
  - `CFUNCTYPE` parameters take an instance of a prototype, not `null` or a
    Number/BigInt address; structure-by-value parameters take an instance or
    field values, not a Buffer or a positional array. `StructDef.create()`
    returns a branded `StructBuffer`, which `struct()` fields and elements
    require instead of any Buffer; `byref()` returns `CArgObject<Tag>`, and
    `POINTER(T).contents` the instance type of `T`. `alignment()` of a Buffer
    or typed array is a type error; `set_errno()` / `set_last_error()` take
    booleans.
  - New typings: `lib.__getitem__(ordinal)` (Number, BigInt or boolean),
    `fn.__name__` on library functions, `in_dll()` of `CFUNCTYPE` prototypes,
    array types and `POINTER(T)`, `POINTER(T).from_buffer()` /
    `from_buffer_copy()` / `from_address()`, BigInt and boolean
    `from_buffer()` offsets of scalars, arrays and structures, boolean and
    BigInt `string_at()` / `wstring_at()` sizes, JS string sources of
    `string_at()` / `wstring_at()` / `memmove()` / `cast()`, BigInt and
    boolean `memset()` values, and a `null` size for
    `create_string_buffer()` / `create_unicode_buffer()`.
  - Typings of the new APIs (see Added): `CField`, `Array`, `c_longdouble`
    (its `__ctype_be__` / `__ctype_le__` typed `| undefined`: they exist only
    where it is `c_double`), `CType.LONGDOUBLE`, `util`, `resize()`,
    `memoryview_at()` (a `MemoryView`, or a `ReadonlyMemoryView` without
    writes, mutating methods or `buffer`, accepted by `from_buffer_copy()`
    but not `from_buffer()`), `SetPointerType()`, `POINTER(name)`,
    `set_type()`, `__pointer_type__`, `_abstract_`, and `_type_` /
    `_length_` on pointer, array and scalar instances.
  - `FormatError()` / `WinError()` codes are typed `number | bigint | boolean`
    (a C `long`, as the runtime accepts); `WinError(true).winerror` is typed
    `boolean`, as the runtime keeps it (Python keeps `True`).

### Fixed

- **Crashes and use-after-free**:
  - A detached view, a detached `ArrayBuffer` or a view out of bounds of a
    shrunk resizable `ArrayBuffer`, passed where memory is taken (a pointer,
    `c_char_p` or `c_wchar_p` argument, sync or async; `addressof`,
    `memmove`, `memset`, `readValue` / `writeValue`, `string_at`,
    `from_buffer`, `cast`, `memoryview_at`), throws `TypeError`
    `memory of a detached or out-of-bounds ArrayBuffer cannot be used` (an
    `ArgumentError` for a function argument). It was passed as NULL or as the
    base address of the buffer: an access violation on Windows, a crash on
    Linux.
  - `release()` of a callback while a JavaScript callback is running no
    longer frees a trampoline that the running C code can still call (for
    example a `qsort` comparator that releases itself): the closure is freed
    by garbage collection, and later calls return zero without running
    JavaScript. A new callback could reuse the freed trampoline and receive
    the old callback's calls. `release()` inside a running call still does not
    throw.
  - `callOn()` with a large structure by value (256 KiB and more) crashed on
    musl, whose default thread stack is 128 KiB: Executor threads now have an
    8 MiB stack on every platform, like the libuv threads used by
    `callAsync()`.
  - `threadSafeCallback` invocations from other threads while the callback's
    environment is closing (Executor teardown) return a zero result and
    record the error
    `thread-safe callback called while its environment is closing; returned zero`,
    instead of waiting for the JavaScript thread. This fixes a
    `worker.terminate()` deadlock when the running call invoked a
    `threadSafeCallback` more than once. The main thread's environment is
    closing from the process `'exit'` event on, so `process.exit()` no longer
    hangs while a worker's `callOn()` call waits for a main-thread
    `threadSafeCallback`.
  - Executor teardown no longer leaks the running call (its argument copies,
    references and library lease) after joining it.
  - A structure, union or array passed by value to `callAsync()` / `callOn()`
    is copied before the call, so transferring its Buffer (`transfer()`, a
    transfer list) while the call runs no longer rejects the promise with
    `buffer argument: memory was detached (transfer() or a transfer list) ...`.
  - The check for whether external Buffers are allowed (Electron) no longer
    wraps one process-wide static byte, shared by every worker environment,
    in an external Buffer without a finalizer.
  - Libraries are no longer unloaded when the `CDLL` object is garbage
    collected, only by `close()`, matching CPython: exported symbol addresses
    obtained with `symbol()` no longer dangle.
  - Re-entrant synchronous calls (`src/function_fast.cc`): `SimpleCall`
    increments `call_depth_` before user getters of inferred variadic
    arguments run, so a re-entrant call no longer clobbers the outer call's
    string buffers.
  - `PointerInstance._sync()` adopts an owner already registered for the
    updated slot address instead of clearing the keepalive.
  - `p[i] = c_void_p / c_char_p / c_wchar_p instance` stores the instance's
    address and keeps its owner alive, as CPython does, instead of
    re-encoding `.value` and losing the keepalive (use-after-free).
  - Variadic async object arguments take one reference each; a SimpleCData
    instance replaced by its value is still retained for the call.
  - On Windows (MSVC builds, as the published `win32-x64` / `win32-arm64`
    prebuilds), a fault inside a foreign call (an access violation or another
    structured exception) throws an `Error`, or rejects the promise of
    `callAsync()` / `callOn()`, as CPython's `OSError`, instead of killing
    the process: `exception: access violation reading 0x0000000000000010`
    (`writing` for a write), `exception: <description>` for other exception
    codes, or `[WinError N] <system text>` with `winerror` / `errno`. Linux,
    macOS and MinGW/GCC Windows builds are unchanged (CPython also crashes
    on POSIX). `string_at()`, `wstring_at()`, `memmove()` and `memset()`
    (foreign calls in CPython) raise the same error for a bad address,
    also through a Buffer or an instance over invalid native memory
    (`T.from_address(16)`); reading a field of such an instance still faults,
    as in CPython. A long `string_at()` / `wstring_at()` reads its first
    character before allocating the copy, so a bad address with a large
    size fails at once without committing gigabytes, and a string longer
    than a JS string can hold throws `RangeError`
    `Invalid string length: N units exceed the maximum JS string length`
    instead of being read (on POSIX it crashed reading past the mapping).
  - A `c_bool` result is true for any non-zero byte; a function with no
    arguments aborted V8, and one with one argument could read a wrong value.
  - Typed variadic and structure arguments still pending from one call can no
    longer leak into a later call.
  - `POINTER(T).from_address(address)` no longer reads the pointer slot when
    it creates the instance (an invalid address such as `16` killed the
    process; CPython reads it only for `.contents` / `p[i]`). Without
    external buffers (Electron) every `from_address()` no longer copies the
    memory at creation either.
- **Conversions**:
  - A function pointer passed without `argtypes` (or as a variadic argument),
    also through an `_as_parameter_` that resolves to a `CFUNCTYPE` instance,
    is passed as a `void *` (it raised `OverflowError`
    `int too long to convert`).
  - Any object with a `from_param` method is a valid `argtypes` item, as in
    CPython (an adapter instance, not only a ctypes type, was rejected with
    `TypeError` `Invalid argument type at index 0: ...`): its result is passed
    as a pointer-sized parameter (see
    [Python ctypes parity](guides/python.md#differences)).
  - `c_int` and `c_long` arrays of the same size (where `long` is 32-bit) are
    interchangeable as array parameters.
  - A Buffer given to a declared `c_char_p` parameter without a trailing NUL
    is passed as a NUL-terminated copy (Python `bytes` are NUL-terminated),
    and an empty Buffer is a valid non-NULL pointer for `c_char_p` and
    `c_void_p` parameters (it was NULL). The same applies to a byte view
    returned by the `from_param` of a `c_char_p` / `c_wchar_p` subclass (a
    wide NUL for `c_wchar_p`): C read past its end.
  - Where `wchar_t` is 16-bit, a character outside the BMP for a `c_wchar`
    parameter raises CPython's
    `argument 1: TypeError: the string '\U0001f600' cannot be converted to a single wchar_t character`
    (was `a unicode character expected, not a string of length 2`).
  - `POINTER(c_char)` / `POINTER(c_wchar)` slices are strings, and
    `p[i] = x` of C data of another type throws `TypeError`
    `incompatible types, c_double instance instead of c_int32 instance`.
    `POINTER(POINTER(T)).from_param(pointer(x))` returns a reference, and a
    `POINTER(c_char * 4)` element accepts a `create_string_buffer(..., 4)`.
  - `from_param(undefined)` behaves as `from_param(null)`, the default
    `from_param` no longer unwraps the `_as_parameter_` of callback wrappers,
    `wintypes.VARIANT_BOOL._type_` is `"v"`, `CFUNCTYPE(...)([name, lib])`
    of a missing export throws `AttributeError` `function 'name' not found`,
    and `CFUNCTYPE(5, null)` throws CPython's `TypeError`
    (`item 1 in _argtypes_ has no from_param method`).
  - `c_bool` arguments and native `c_bool` fields treat `NaN` as true
    (Python truthiness), on the native entry, generic call and `callAsync()`.
  - Where `long` is 32-bit, `c_long.from_param(c_int(5))` and
    `DWORD.from_param(UINT(5))` return the instance, and
    `c_long.__ctype_be__` is `c_int.__ctype_be__` (one class), as CPython.
  - Callbacks whose `argtypes` or `restype` are `__ctype_be__` types receive
    and return byte-swapped values, as CPython.
  - `DataView` is accepted wherever JS memory is (pointer/string fields and
    arguments, struct-by-value bytes) instead of failing with
    `Invalid argument`.
  - By-value struct/union argument errors from the addon read
    `argument N: TypeError: expected structure|union instance instead of <type>`.
  - Unconvertible variadic objects raise `ArgumentError`
    `argument N: TypeError: Don't know how to convert parameter N`.
  - `pointer(Buffer)` is `POINTER(c_void_p)` again for every Buffer length
    (buffers shorter than a pointer had become char arrays), so it is
    accepted by `POINTER(c_void_p)` parameters, and `pointer()` of
    `create_string_buffer()` / `create_unicode_buffer()` points to an array
    of their own length.
  - `POINTER(T * n)[i]` accepts an instance of the array type (byte copy with
    references) or a JS array (Python tuple). Other values raise
    `expected <Array> instance` / `incompatible types` TypeErrors.
    `writeValue` supports array types, and `readValue` / `writeValue` errors
    name the type.
  - `readValue()` / `writeValue()` offsets must be non-negative safe integer
    Numbers: `NaN`, `Infinity`, fractions, negative and unsafe values raise
    `RangeError` `offset must be a non-negative safe integer (got 1.5)`, other
    types `TypeError` `offset must be a number, not string`. `NaN`,
    `Infinity` and fractions were truncated (`readValue(address, c_int32, NaN)`
    read at offset 0, `writeValue(buf, Pair, value, 1.5)` wrote at offset 1),
    and a string offset was a `RangeError`.
  - `addressof()` of a `DataView` returns the address of its first byte
    (`addressof(new DataView(ab, 4, 8)) === addressof(ab) + 4n`); it threw
    `TypeError` `memmove: addressOf must be a Buffer or an address`.
  - The result conversion of `callAsync()` / `callOn()` and of the generic
    call path reads `c_long`, `c_ulong`, `c_size_t` and `c_ssize_t` with
    their C width, as the direct paths do, instead of always reading 64 bits
    (wrong where `long` / `size_t` are 32-bit).
  - Integer results narrower than the ABI word (`c_int8` to `c_int32` and
    their unsigned forms, `c_bool`, `c_char`, `c_wchar`, and `c_long` /
    `c_size_t` where they are 32-bit) are read from the complete `ffi_arg`
    slot libffi and the direct invokers widen them to, on every native
    conversion path (synchronous, fast entries, `callAsync()` / `callOn()`,
    `errcheck`). On a big-endian host (e.g. Linux s390x, not among the
    supported platforms) they read the high bytes of the slot: `0` or `-1`
    instead of the result. Little-endian hosts are unchanged.
  - `PointerInstance.set()` accepts array instances and pointers created
    from an address.
  - `CFUNCTYPE` / `WINFUNCTYPE` prototypes create NULL function pointers, as
    CPython: `P()`, `P(0)`, `cast(null, P)` and `cast(0, P)` return a function
    whose `address` is `0n` (`P(0)` threw
    `Function pointer is NULL - cannot call invalid function`, the others a
    `TypeError`). Calling it throws `Error`
    `exception: access violation writing 0x0000000000000000` (CPython's
    `OSError` on Windows), or rejects for `callAsync()` / `callOn()`.
    `P(null)` is still a `TypeError`, as in CPython.
- **Structures and arrays**:
  - Tuple and plain-object assignments to nested struct/array fields are
    atomic: a failing element leaves the field unchanged.
  - A bound class or a `Proxy` of a class assigned as `restype` is
    constructed with `new` too.
  - The positional `Structure` constructor includes `_anonymous_` fields and
    nested tuple initializers, and type-checks nested struct/array values.
  - `_anonymous_` may name a field inherited from a base class. A name that
    is not a field throws an `AttributeError`-named error instead of a
    generic `Error`.
  - `defineStruct()` / `defineUnion()` honor the `pack`, `packed`, `align`,
    `layout` and `swapped` options.
  - `util.inspect` / `console.log` work on `struct()` / `union()` instances,
    their array fields and arrays of them. Array `wrap()` and `from_buffer`
    no longer add a property to the caller's Buffer.
  - `bitfield()` errors name `struct()` / `union()` definitions (`struct` /
    `union`) instead of `[object Object]`, and reject structure, pointer and
    array types.
  - Writes outside an array field of a structure received by a callback
    throw `RangeError`.
  - A zero-length view at the end of a pooled Buffer (`Buffer.from()`,
    `Buffer.allocUnsafe()`) covers only its own bytes in pointer bounds
    checks, not the start of the adjacent Buffer.
- **Libraries**:
  - `CDLL` is no longer a thenable: `await new CDLL(...)` and
    `JSON.stringify(lib)` work.
  - `CDLL(name, { handle: 0 | 0n })` is accepted as in CPython (glibc
    `RTLD_DEFAULT` is 0); only `null` or `undefined` mean "load by name". A
    negative Number or BigInt handle is masked to the pointer width (glibc
    `RTLD_NEXT` is `-1`), and `_handle` is the value given, with its sign
    (`-1n`, as CPython's `_handle == -1`); without an explicit handle
    `_handle` is the loaded module handle. A handle outside the pointer range
    throws `RangeError`
    `could not convert the _handle attribute to a pointer`, a non-integer
    Number `RangeError` `Library handle must be a valid safe integer`.
  - `CDLL` rejects library paths with an embedded NUL character with
    `RangeError` `embedded null character` (Windows) /
    `embedded null byte` (Linux, macOS), CPython's `ValueError`, instead of
    trying to load the name.
  - A JS class assigned as `restype` is constructed with `new` on sync, async
    and prototype calls, as CPython calls a class restype. This includes
    built-in classes (`Uint8Array`), bound classes and `Proxy` wrappers.
  - COM methods: a NULL interface, a missing vtable and a missing `this`
    raise `RangeError` (CPython `ValueError`) with CPython's messages.
    `callAsync()` / `callOn()` reject instead of throwing synchronously, and
    keep `this` alive until the promise settles. `errcheck` receives the
    method itself and the arguments without `this`.
- **Windows**:
  - The addon links the Universal CRT dynamically (vcruntime stays static, no
    VC++ redistributable needed), so `use_errno` / `get_errno` see `errno`
    set by `ucrtbase.dll` and `/MD` DLLs, as in CPython. The addon now imports
    `api-ms-win-crt-*`, which ships with Windows 10 and later.
    `test_use_errno` runs on Windows.
  - `FormatError()` / `WinError()` strip all trailing whitespace from system
    messages, as CPython does, and `FormatError` returns `<no description>`
    for unknown codes.
  - `wintypes` gains the CPython 3.14 names `HRESULT`, `HFILE`, `HDROP`,
    `HCONV`, `HCONVLIST`, `HDDEDATA`, `HSZ`, and lists `HCURSOR` with the
    handle types.
  - `GetLastError()` returns the value left by the previous foreign call even
    when JavaScript or the garbage collector runs in between.
- **Build**: 32-bit ARM/x86 Node on a 64-bit Linux kernel (`NODE_ARCH` `arm`
  / `ia32`, or a 4-byte pointer compiler) selects the 32-bit libffi port
  instead of aarch64/x86_64. The root `CMakeLists.txt` forwards the detected
  target architecture to `libffi_cmake` (`CMAKE_VS_PLATFORM_NAME`,
  `CMAKE_OSX_ARCHITECTURES`, `NODE_ARCH`).

### Added

- `CDLL.prototype.__getitem__(name)`, CPython's `lib[name]`: a new function
  for the C export `name`, even when a library member (`close`, `func`,
  `symbol`, …) has the same name. On Windows an integer (Number, BigInt or
  boolean, masked to 16 bits) looks up an export by ordinal
  (`function ordinal N not found` when missing); other values throw
  `TypeError` `function name must be string, bytes object or integer`.
  Functions read from a library have `__name__` (not ordinal lookups).
- `in_dll(lib, name)` on `CFUNCTYPE` / `WINFUNCTYPE` prototypes (the stored
  function pointer, read once) and on array types, and CPython's
  `POINTER(T).from_buffer()` / `from_buffer_copy()` / `from_address()` /
  `in_dll()`, whose memory is the pointer slot itself (unlike the Node
  `fromBuffer()` / `fromAddress()`, which point to that memory).
- `from_buffer()` / `from_buffer_copy()` of scalar and array types (and
  structures) accept BigInt and boolean offsets; array types use the
  structure messages (`offset cannot be negative`,
  `Buffer size too small (4 instead of at least 8 bytes)`).
- `CDLL(name, { handle })` wraps an existing OS module handle without taking
  ownership, and `CDLL` exposes `_name` / `_handle`.
- `CFUNCTYPE` / `WINFUNCTYPE` accept `{ use_errno, use_last_error }` options,
  and COM vtable prototypes `prototype(vtblIndex, name[, paramflags[, iid]])`
  (Windows).
- `callback()` wrappers expose `getLastError()` and `setErrorHandler()` like
  `threadSafeCallback()` wrappers, and `threadSafeCallback()` reports
  return-conversion errors to them.
- Built-in `from_param` on SimpleCData, Structure/Union, `POINTER(T)`, array
  and `CFUNCTYPE` / `WINFUNCTYPE` types (CPython `CDataType_from_param`: an
  instance of the type, or an object whose `_as_parameter_` is one), `_type_`
  codes, and `__ctype_be__` / `__ctype_le__` byte-order variants.
- `pointer(cfunctypeInstance)` returns an `LP_CFunctionType` pointing at a
  slot that holds the function's address (`pf[0]()` / `pf.contents()` call
  it), as CPython.
- `AttributeError` (the error class of missing library exports) and
  `CDataAggregate` (the base class of `Structure` and `Union`) are exported.
- `CField` class attributes (`S.field.offset`, `.size`, `.byte_offset`,
  `.byte_size`, `.bit_offset`, `.bit_size`, `.is_bitfield`,
  `.is_anonymous`) on Structure and Union, available right after the class
  definition, before any `sizeof` or instantiation. In byte-swapped
  structures and unions the `type` of a scalar or bit field is its swapped
  type (`c_int32_be`), as for arrays and in CPython. Fields named like
  Function members or internal type markers are not exposed as class
  attributes. `CField` is exported as a class (`S.x instanceof CField`); as
  in CPython its constructor is internal API: it takes the keyword arguments
  as one object
  (`new CField({ name, type, byte_size, byte_offset, index, _internal_use: true, bit_size, bit_offset })`),
  throws `TypeError` without them (`CField() missing required argument 'name' (pos 1)`)
  and `RangeError` (CPython `ValueError`) for a `byte_size` other than the
  type size (`byte size of field 'a' (2) does not match type size (1)`) or a
  bit field that overflows its type
  (`bit field 'x' overflows its type (2 + 7 > 8)`).
- Array types expose `_type_`, `_length_`, a Python-style `.name` and
  `instanceof`; `from_buffer` / `from_buffer_copy` accept every
  `ArrayBufferView`. Array instances expose `_type_` and `_length_`, pointer
  instances `_type_` and scalar instances `_type_`
  (`new c_int(1)._type_`), as the class attributes through an instance in
  CPython.
- `Array`, CPython's `ctypes.Array` abstract base (not the native
  `ArrayType`; importing it shadows the global `Array` in that module, so
  `import { Array as CArray }` may be preferable):
  `class T extends Array { static _type_ = c_int; static _length_ = 13 }` is
  an array type with the layout of `ARRAY(c_int, 13)`, checked when it is
  first used (CPython: when it is defined). A missing attribute throws
  `AttributeError` `class must define a '_length_' attribute` (or
  `'_type_'`), a non-integer length `TypeError`
  `The '_length_' attribute must be an integer`, a negative or too large one
  (above `Number.MAX_SAFE_INTEGER`) `RangeError`
  `The '_length_' attribute must not be negative` / `is too large`. The base
  itself cannot be instantiated or used with `from_buffer()` (`TypeError`
  `abstract class`), and `Array.from_param(x)` throws `TypeError`. As in
  CPython such a subclass is its own type: fields, `from_param` / `argtypes`,
  pointer and array elements accept only instances of it (or of its
  subclasses), not a same-shape `ARRAY(c_int, 13)` instance or a
  `create_string_buffer()` (`TypeError`). Every ctypes array is
  `instanceof Array`.
- `c_longdouble` (C `long double`). Where `long double` is a `double`
  (Windows, macOS ARM64) it is `c_double` itself, as in CPython; elsewhere it
  is its own type (`_type_` `"g"`): 16 bytes, 16-aligned on x86-64 (80-bit
  x87) and on Linux ARM64 (IEEE binary128), 12 bytes, 4-aligned on 32-bit
  x86. Its value is a JS number, rounded to double as CPython's `float`
  (beyond the double range a read is `±Infinity`); it has no
  `__ctype_be__` / `__ctype_le__` (as CPython), so a `BigEndianStructure`
  field of it is a `TypeError`. It works as a declared, untyped or variadic
  argument (not promoted), as a result (synchronous, `callAsync()` /
  `callOn()`, `errcheck`), in callbacks, pointers, arrays, fields and
  `from_address()`, always through libffi. `CType.LONGDOUBLE` is its
  `CType`.
- CPython 3.14's incomplete pointer types: `POINTER("Name")` returns the same
  incomplete type for a name (deprecated, as in CPython: a
  `DeprecationWarning` with code `NODE_CTYPES_POINTER_STRING`, once per
  process). It can be a field type and is used with `from_buffer()` /
  `from_address()`, but creating an instance throws `TypeError`
  `Cannot create instance: has no _type_`. `P.set_type(T)` completes (or
  retargets) it, keeping its name `LP_Name` as CPython, and sets
  `T.__pointer_type__` when T has none, and
  `SetPointerType(P, T)` is the deprecated spelling (`DeprecationWarning`
  `NODE_CTYPES_SET_POINTER_TYPE`). A `POINTER("Name")` parameter is resolved
  at call time, so it works after `set_type()`; before, a non-NULL argument
  raises `ArgumentError` `expected LP_Name instance instead of c_int32`. This
  replaces the `TypeError`
  `incomplete pointer types are not supported, pass a thunk`; thunks
  (`POINTER(() => T)`) still work.
- `T.__pointer_type__`, as in CPython 3.14: the type `POINTER(T)` returns,
  set by the first `POINTER(T)` (undefined before, not inherited by
  subclasses), writable and deletable; `POINTER(T)` reads it.
- `resize(obj, size)`: grows the memory of an instance that owns it, keeping
  its contents (the new bytes are zero), and `sizeof(obj)` reports the new
  size. A size below the type size throws `RangeError`
  `minimum size is 4`, an instance that views memory it does not own
  (`from_buffer()`, `from_address()`) `RangeError`
  `Memory cannot be resized because this object doesn't own it` (CPython
  `ValueError`). Unlike CPython, the instance moves to new memory, and
  `create_string_buffer()` / `create_unicode_buffer()` Buffers cannot be
  resized. Pointer instances resize as in CPython: `pointer(x)`,
  `POINTER(T)()`, `cast()` and `from_buffer_copy()` results own their memory;
  fields, elements, `from_buffer()` / `from_address()` and `contents` do not
  (see [Python ctypes parity](guides/python.md#differences)).
- `memoryview_at(ptr, size, readonly = false)` (CPython 3.14): a view of
  `size` bytes at `ptr`, which takes what `c_void_p` takes (an address, an
  array, a pointer, `byref()`, a Buffer; a structure, union or other scalar
  instance throws `ArgumentError`
  `argument 1: TypeError: 'S' object cannot be interpreted as ctypes.c_void_p`,
  as in CPython). A writable view is a Buffer over
  that memory (`readonly` is `false`); a read-only view is a `Proxy` of one
  whose writes and mutating methods throw `TypeError`
  `cannot modify read-only memory`, which hides `.buffer` and which
  `from_buffer()` rejects (`TypeError` `underlying buffer is not writable`).
  Without external buffers (Electron, `NODE_CTYPES_NO_EXTERNAL_BUFFERS=1`) a
  view of native memory is a `Proxy` that re-reads the memory before reads
  and writes it back after writes. `Buffer.from(view)` copies any of them. A
  negative size throws `RangeError`
  `memoryview_at: size is negative (or overflowed): -1`.
- `util`, CPython's `ctypes.util`: `util.find_library` (also exported at the
  top level, as before) and CPython 3.14's `util.dllist()`, the paths of the
  shared libraries loaded in the process (EnumProcessModules on Windows,
  dyld on macOS, `dl_iterate_phdr` on other POSIX systems; glibc lists the
  main program as `""`, and on musl the C library is listed as its loader
  `ld-musl-*.so.1`). It is `undefined` on a POSIX system without
  `dl_iterate_phdr`, as in CPython.
- `POINTER(T)` fields, `POINTER` array elements and `pp[i]` accept a ctypes
  array of a compatible element type, and `create_string_buffer()` /
  `create_unicode_buffer()` for `POINTER(c_char)` / `POINTER(c_wchar)`. The
  array's address is stored and the array is kept alive.
- Negative pointer indexes (`p[-1]`), `sizeof()` / `alignment()` of pointer
  and array instances, of `CFUNCTYPE` / `WINFUNCTYPE` instances, library
  functions and callback wrappers (pointer size), and `alignment()` of
  `create_string_buffer()` / `create_unicode_buffer()` results
  (1 / `sizeof(c_wchar)`).
- Live `POINTER(POINTER(T)).contents` views, and `p[i] = new c_int32(v)`.
- A plain JS callable as `restype`, and `string_at(ptr, -1)` /
  `wstring_at(ptr, -1)`.
- `tests/benchmarks/benchmark_js_paths.js` (`npm run bench:js-paths`) for the
  JavaScript-layer hot paths, and `tests/benchmarks/ab_js_paths.js`
  (`npm run bench:js-paths:ab`), which compares two builds in fresh process
  pairs in both orders and rejects a variant with a case more than 5% slower
  in both.
- CPython parity pairs in the topical `tests/cpython_parity/<area>/`
  files for the behaviors above, checked against CPython 3.14 by
  `tests/check_parity.js`.
- `tests/cpython_parity/stdlib/`: the 49 applicable CPython 3.14
  `Lib/test/test_ctypes` suites, each with its Python twin (adapted from the
  Personal rework of node-ctypes), running against the shared fixture's
  `_ctypes_test` exports; the other 9 suites test CPython internals. See
  [tests/README.md](tests/README.md#cpython-stdlib-suites).

### Documentation

- **Examples updated for the CPython-aligned conversions** (each written the
  way a CPython user would, and run on 2.16.0):
  - COM (`comtypes.js`, `ads.js`): `GUID` structures go to the `REFCLSID` /
    `REFIID` (`LPVOID`) parameters of `CoCreateInstance` and `QueryInterface`
    as `byref(guid)`, and `ADS_SEARCH_COLUMN` to `GetColumn` / `FreeColumn` as
    `byref(column)`; `SysAllocString` / `SysFreeString` / `SysStringLen` and
    `FreeADsMem` are bound through `WinDLL` (`OleDLL` checks every result as
    an `HRESULT`). The Active Directory explorer initializes its window thread
    as a single-threaded COM apartment for the whole process.
  - LDAP (`ldap.js`): the paging cookie goes to the `POINTER(LDAP_BERVAL)`
    parameters as a pointer instance (`cast(address, PBERVAL)`), not an
    integer address.
  - Embedded Python (`python.js`): `PyCFunction_NewEx` receives
    `byref(methodDef)`, and Python strings read with `string_at()` are decoded
    as UTF-8.
  - Cryptoki (`demo_softhsm2.js`): `C_OpenSession` receives `CK_NOTIFY()` (a
    NULL function pointer) instead of `null`, and attribute values point to
    scalars through `cast(byref(value), c_void_p)`.
  - Windows controls (`demo_controls.js`): the folder dialog's
    `BROWSEINFOW.pszDisplayName` (`LPWSTR`) is set to
    `cast(buffer, LPWSTR)`; assigning the `create_unicode_buffer()` array
    itself raises `TypeError`
    `incompatible types, c_wchar_Array_260 instance instead of c_wchar_p instance`,
    as in CPython, so Browse did not open the dialog.
  - macOS tray (`tray.js`): an existing bug fixed: on Intel, methods returning
    structures larger than 16 bytes (`NSRect`) go through
    `objc_msgSend_stret`.
  - Verified: the Windows examples (registry, COM shortcut, Active Directory,
    LDAP, tray, controls, Active Directory explorer), the Python, Cryptoki and
    smart card examples and the Electron app on Windows, the Python examples
    on Linux musl, in both memory modes; the macOS examples were checked
    statically.

### Performance

Figures are indicative: they were measured with x64 Node emulated on
Windows ARM64, not with the A/B method of
[tests/benchmarks/README.md](tests/benchmarks/README.md), except where an entry
says otherwise.

- Structure and union instances passed beyond `argtypes` (by value, as
  CPython) no longer rebuild their native layouts on every call: each distinct
  set of layouts is registered once per function (up to 8) and the call takes
  the native fast path with a cached CIF. On native ARM64 Linux (paired A/B),
  raylib's `ImageDrawTextEx` with the `Color` beyond its 6 argtypes, as the
  upstream Koffi benchmark declares it, drops from about 2.0 to 0.93 µs per
  call, within about 5-9% of the same call with 7 argtypes.
- A structure or union argument that is an instance of the declared class
  skips the generic parameter probes: `ImageDrawTextEx` with 7 argtypes goes
  from about 1.13 to 0.86 µs and `ImageClearBackground(byref(img), color)`
  from 248 to 206 ns on native ARM64 Linux, both faster than 2.15.5.
- Declared `c_wchar_p` arguments take the native fast path: a JS string that
  fits the 512-byte inline buffer is converted to `wchar_t` there, and `null` /
  `undefined` too, without the generic call path. `f(Buffer, "de", Buffer)`
  with argtypes `[c_char_p, c_wchar_p, c_char_p]` goes from about 221 to
  159 ns per call on native ARM64 Linux, faster than 2.15.5.
- A plain non-empty view (`Buffer`, typed array, `create_string_buffer()`)
  passed to a one-pointer parameter (`c_void_p`, `POINTER(T)`) no longer has
  its length checked twice: the JS wrapper's check, read last before the call,
  is the only one, and pending extra-argument state is handled off the direct
  path. `addr(create_string_buffer(8))` with `c_void_p` is back to its 2.15.5
  cost in steady state on native ARM64 Linux (it was about 12% slower).
- Windows: the structured-exception guard around each foreign call passes the
  function and its arguments in registers, and the hot paths (zero- and
  one-argument scalar calls, one-pointer calls, precompiled calls) call it
  without captures. `rand()` and `atoi()` are back within 1-2.5% of 2.15.5 on
  native Windows ARM64 (they were 5-6% slower); other platforms are unchanged.

- Native entry for int32/double/float signatures with any scalar result
  (uint32, int64, 8/16-bit, bool, pointer): about 8-19% faster per call.
- A library attribute with `errcheck` set dispatches in JS without the native
  entry's defer hop (about 275 -> 125 ns). `use_last_error` / `use_errno`
  libraries keep the native fast entry (no JS wrapper per call).
- Function pointers created from an address share their metadata accessors
  through a prototype (fewer own properties per instance); instantiation
  time did not change measurably.
- Plain-object assignments to a nested structure field without pointers
  (`s.pt = { x, y }`) copy the field through one pooled scratch Buffer
  instead of a zero-filled one plus a reference-aware copy: about 1100 ->
  525 ns.
- `POINTER(T)` instances use one `PointerInstance` class and one shared
  `Proxy` handler per pointer type instead of per-instance closures,
  accessors and handlers (`fromAddress` and `pointer(x)` several times
  faster, much less heap per pointer).
- The memory ranges of views used for pointer bounds checks are registered
  in O(log n): creating many views of the same memory no longer slows down
  quadratically.
- `struct()` / `union()` / array creation without a redundant zero fill and
  with compiled field writers; an identity fast path for pointer field
  writes; cached `Proxy` handlers in `struct().create()`, `union().create()`
  and `array(structDef, N)`; `from_buffer` of arrays about 2.5x faster.
- Lazily allocated `extra_call_cache_` (about 6 KB less RSS per
  non-variadic `FFIFunction`), and `void()` and mismatched unary/nullary
  signatures routed to `CoreDirectEntry` / `AllInt32Entry<2>` /
  `ScalarFrameEntry<2>`.
- SimpleCData instances passed beyond `argtypes` (variadic arguments, or a
  function without `argtypes`), as CPython requires for doubles there, no
  longer take the slow generic path. The JS wrapper and the native entry pass
  each built-in instance's C value with its own type, so the native call reads
  no properties and infers nothing. On native ARM64 Linux (Node.js 26.13.1,
  paired A/B against the previous build), ten `c_double` variadic arguments
  drop from about 3.5 µs to 0.46 µs per call, one `c_double` from about
  650 to 210 ns, three `c_int32` from about 1.2 µs to 290 ns, and
  `f(7, new c_double(1.5), 3)` without `argtypes` from about 650 to 180 ns
  (`callAsync`: about 40% less). The other call paths showed no measurable
  change. In the Koffi comparison on the same machine, "variadic doubles"
  is 1.15x Koffi (376 / 328 ns).

## [2.15.5] - 2026-11-23

### Changed

- **Single-allocation `callAsync()` worker (`src/function.h`, `src/function_async.cc`)**:
  - Embedded `FFIFunction::PreparedCall` directly by value inside `CallWorker`
    via `PrepareAsyncCall<Target>`, cutting per-call heap allocations for
    `callAsync()` from two to one.
  - Skipped `std::chrono::steady_clock::now()` timing inside `PreparedCall::Run`
    for `callAsync()` (timing is now measured only for `Executor::callOn`),
    skipped the redundant `Napi::HandleScope` in `CallWorker::OnOK`, and removed
    redundant default zeroing of `PreparedCall::inline_arg_storage_` /
    `inline_arg_values_`.
- **Inferred and variadic MRU direct-to-frame path (`src/function.h`, `src/function_fast.cc`)**:
  - Added out-of-line `FFIFunction::TryExtraFrameCall` for monomorphic inferred
    and variadic calls hitting `last_extra_cache_`, marshalling numeric and
    null/BigInt pointer arguments directly into `frame::Plan` without
    intermediate `slots[]`, `AcquireExtraCall` memcmp, or the second
    `slots -> frame_words` copy (with zero code growth in the `num_extra == 0`
    `SimpleCall` path), and added direct `int64`/`uint64` return handling in
    `SimpleCall`.
- **Mixed numeric register-frame entry (`src/function.h`, `src/function_fast.cc`)**:
  - Added `FFIFunction::ScalarFrameEntry<Capacity>` (capacity 4, 8, 16, or 32)
    for 2–32 argument pure numeric signatures on `frame::Plan` not already
    handled by `CoreDirectEntry`, `AllInt32Entry`, or `MixedEntry`, writing
    directly into `frame_words` without `SimpleCall`'s string/pointer/variadic
    stack state.

## [2.15.4] - 2026-11-23

### Fixed

- Fixed an out-of-bounds read in `FFIFunction::MarshalArguments`
  (`src/function.cc`) when calling variadic or inferred functions with more than
  32 extra arguments (`extra_types_overflow` fallback).
- `StructType.create()` accessors (`src/struct.cc`) now support nested
  `StructType` and `ArrayType` fields on both get and set instead of returning
  `undefined` / throwing.
- `StructInfo::CalculateLayout` and `ArrayInfo` (`src/layout.cc`) now guard
  layout arithmetic against `size_t` overflow.
- Functional `union().toObject()` now supports assigning nested `struct()` /
  `union()` fields and invalidates cached nested snapshots on any aliased field
  write instead of throwing `TypeError` or returning stale snapshots.
- Nested `union()` fields returned by `union.get()` now share `buildWrapper()`
  with `struct()`, enabling promoted `_anonymous_` subfields and mirror-mode
  (`NODE_CTYPES_NO_EXTERNAL_BUFFERS=1`) synchronization, with per-field cached
  nested handlers in both `struct()` and `union()`.

### Changed

- **Executor RAII & spin loops (`src/executor.h`, `src/executor.cc`)**:
  - Replaced the raw owning `PreparedCall*` in `ExecutorJob` with
    `std::unique_ptr<FFIFunction::PreparedCall>`, removing manual `delete`
    cleanup across `DeliverExecutorCompletions`, `Abandon`, `Deliver`, and
    `Cancel` (keeping only the explicit `.release()` on abandoned in-flight
    calls).
  - Consolidated `spin` / `spinLimit` option validation via `ReadMicrosOption`,
    added RAII `DeliveringGuard` in `Executor::Deliver`, used
    `std::ranges::find_if` in `Executor::Cancel`, and added architecture-aware
    `CpuRelax()` pause hints (`_mm_pause` / `yield`) inside spin-wait loops.
- **Internal deduplication, tooling, and CI**:
  - Centralized exact `double` → `{int32_t, uint32_t, int64_t, uint64_t}`
    conversion in `TryExactInt<T>` (`src/types.h`), reused across
    `function_marshal.h`, `function_fast.cc`, and `callback.cc`.
  - Simplified `specializeCall` in `lib/core/invocation.js` via per-binding
    `makePlainArgStep` / `applyOrConvert` (preserving monomorphic V8 inlining)
    and removed unused parameters from `finishOwned`.
  - Added `format`, `format:cpp`, `format:js`, and `format:check` scripts in
    `package.json`, removed the TypeDoc directory-link warning in
    `examples/macos/tray/README.md`, and added a Linux `sanitizers` CI job
    covering `-DCTYPES_ENABLE_DIRECT_CALLS=OFF` and UndefinedBehaviorSanitizer.

## [2.15.3] - 2026-11-22

### Changed

- **Multi-argument pointer calls (`memset`, `memcpy`, `qsort`)**:
  - Extended single-probe plain `ArrayBufferView` pass-through in
    `specializeCall` (`lib/core/invocation.js`) to 2–4 argument signatures with
    a leading `c_void_p`, avoiding per-call owner-array allocations for plain
    `Buffer`/`TypedArray` views.
  - Added `FFIFunction::DirectPointerCall` (`src/function_fast.cc`) for 2–4
    argument signatures composed of pointers and 32/64-bit integers returning a
    direct scalar or pointer, writing directly into `frame::Plan` and falling
    back cleanly without extra `napi_get_cb_info` re-reads on variadic calls.
- **Synchronous and thread-safe callback hot path**:
  - Added `CallbackBaseData::simple_args` with inline scalar/pointer argument
    conversion (`SimpleCallbackArgToJS`), direct `napi_fast::CallFunction`
    invocation on the `napi_ok` path, inline `c_int32`/`c_uint32` return fast
    paths in `StoreNumberResult`, and raised `ScopelessCallbacks::kBudget` from
    `64` to `2048` to avoid per-invocation `HandleScope` churn in C callback
    loops such as `qsort`.
- **Plain-object struct arguments and scalar struct returns**:
  - Reused the unused 64-byte tail of `PreparedCall::inline_arg_storage_` for a
    by-value struct argument (`17–64` bytes, `argc <= 4`) without growing
    `sizeof(PreparedCall)`, avoiding per-call heap allocations in `callAsync()`
    and `callOn()` for common HFA and medium struct arguments.
  - Monomorphized `createScalar` and `structResultReaders` for 1–5 scalar fields
    in `lib/structures/helpers/struct.js` and added a single-probe plain-object
    fast path (`resolvePlain`) across 1–4 argument wrappers in `specializeCall`
    (`lib/core/invocation.js`), preserving left-to-right error order and
    single-read `create`/`set` override semantics.

## [2.15.2] - 2026-11-22

### Changed

- **Synchronous call fast paths**:
  - Extended exact-prototype `() -> T` and `(T) -> T` native entry
    specializations to `c_bool`, added `UnaryStringEntry` for one-argument
    `c_char_p` calls with per-position `long_string_hints_` to skip truncated
    inline copies on repeated long strings, added `CoreDirectEntry` for 2–4
    argument `{int32, float, double}` fixed direct calls, and added
    `AllInt32Entry` for homogeneous `c_int32` signatures up to 32 arguments.
  - Generalized `UnaryPointerCall` to cover any one-argument `c_void_p`
    signature returning a scalar or pointer, added a 17–32 argument capacity
    tier to `FastEntry`/`FastCall`, and limited argument re-reads to the exact
    `argc`.
  - Added single-probe plain `ArrayBufferView` pass-through and direct
    `callbackPointer` owner tracking on `c_void_p` JS wrappers, direct
    `Reflect.apply` forwarding for primitive variadic calls, and
    arity-specialized `callAsync` wrappers (0–2 arguments) for functions with
    result converters.
- **Callback aggregate snapshots and views**:
  - Functional `struct()`/`union()` callback arguments now slice their owned
    8 KB snapshot pool directly in C++ (`Uint8Array` via Node-API, with
    `napi_is_detached_arraybuffer` recovery), avoiding a C++ → JS
    `allocSnapshot` call per invocation. Over-aligned layouts, >2 KB values,
    class `Structure`/`Union` signatures, mirror mode, custom allocators and
    raw native callbacks keep their existing allocators.
  - Replaced per-call `Proxy` wrapping for functional callback struct arguments
    and small native-endian numeric array fields (`count <= 64`) with cached
    prototype-backed views (`StructCallbackView` and `FastArrayView`) that
    materialize `_buffer` lazily and preserve full CPython write validation,
    and specialized callback adapters for 1–3 struct arguments.
- **Apple ARM64 variadic calls and extra-call cache**:
  - Enabled register-frame dispatch for variadic calls on Apple ARM64
    (placing anonymous arguments in 8-byte aligned stack slots after closing
    register banks), stored `frame::Plan::offsets` and `ExtraCallCache` extra
    types inline (up to 32), and added an MRU slot check in `AcquireExtraCall`.
- **Internal architecture and async allocation reductions**:
  - Added inline Small Buffer Optimization in `FFIFunction::PreparedCall`
    (up to 8 arguments and 64-byte struct/array returns), removing per-call
    heap `std::vector` allocations for common `callAsync()` and `callOn()`
    invocations.
  - Centralized `CType` predicates and scalar visitor (`IsNumericCType`,
    `IsDirectScalarReturn`, `VisitScalarCType`) in `src/types.h`, unified
    `Callback` and `ThreadSafeCallback` JS-thread execution on shared
    `CallbackBaseData` / `InvokeCallbackOnJsThread`, and split `src/function.cc`,
    `src/callback.cc`, and `lib/memory/pointer.js` into focused modules
    (`function_marshal.h/.cc`, `function_fast.cc`, `function_async.cc`,
    `callback_threadsafe.cc`, `pointer-ops.js`).
  - Unified function-wrapper construction (`buildFunctionBinding` in
    `lib/core/invocation.js`) across `CDLL` and `CFUNCTYPE`/`WINFUNCTYPE`, and
    shared field-accessor compilation (`compileFieldAccessors`) across
    `struct()` and `union()`.

## [2.15.1] - 2026-11-22

### Changed

- Short asynchronous calls with inferred or variadic arguments can reuse a
  completed call's libffi interface. Each in-flight call still owns its own
  interface; declared signatures and result buffers are unchanged.
- Reduced synchronous public call overhead for `() -> T` and `(T) -> T` when a
  fixed direct invoker is available and `T` is a fixed-width integer, `float`
  or `double`. On x64, signatures with a floating-point argument still use the
  existing ABI path. `int64` and `uint64` still return a `bigint`.
- Reduced synchronous call overhead when a function takes one pointer and
  returns a pointer, using the existing ABI register frame and argument
  conversions.
- Reduced JavaScript wrapper overhead for synchronous one-argument calls
  without custom argument or result handling, including `c_void_p` addresses
  passed as `bigint`. Argument conversion and ownership checks still run.
- Reduced the overhead of accessing single-digit indices in ctypes arrays.
- Synchronous calls with 9–16 declared arguments can read them in one
  Node-API call instead of two, without changing argument conversion.
- Synchronous public bindings taking 4 or 8–16 arguments in the repeating
  order `(int8, uint8, int16, uint16)` and returning `int32` or `int64` can convert
  `Number` and `BigInt` arguments directly into the register frame.

## [2.15.0] - 2026-11-20

### Changed

- Reading a nested `Structure` or `Union` field returns a fresh view each
  time, as in CPython: `s.inner === s.inner` is now `false`. Both views
  still refer to the same C bytes. Keep a reference to the view if your
  code relies on JavaScript object identity or attaches properties to it.
- `from_buffer()`, `from_address()`, nested fields and array elements now
  expose existing `Structure` or `Union` storage without running the user's
  constructor or JavaScript instance field initializers. Explicit `new T()`
  still runs them. This does not change by-value callback arguments: their
  constructor is still called with no arguments.

### Fixed

- **libffi headers generated on Windows**: with `core.autocrlf` the templates
  are checked out with CRLF line endings, and `npm run generate-ffi-headers`
  silently left out of `fficonfig.h` the `FFI_MMAP_EXEC_WRIT` block of macOS
  x64, whose marker contains line feeds (`ffi.h` only got mixed line endings).
  The generator now reads its templates with LF line endings, and stops with an
  error when a marker it replaces is missing. The published binaries were not
  affected: in CI only the Windows checkouts use CRLF, and the Windows builds
  do not use that block.

## [2.14.0] - 2026-11-15

### Added

- **`Version.libffi`**: the version of the libffi node-ctypes is built with
  (`ffi_get_version()`), for example `"3.8.1"`.

### Changed

- **Callbacks on hardened Linux**: libffi is built as its `configure` does on
  Linux x86-64 and AArch64, with static trampolines and `memfd_create`.
  - The code of a callback now comes from a table inside `ctypes.node`, mapped
    read and execute: closures no longer need a page that is writable and
    executable. When the table cannot be mapped, libffi falls back to the
    dynamic trampolines.
  - In that fallback, when writable and executable pages are refused (SELinux,
    PaX, Memory-Deny-Write-Execute), libffi maps an anonymous memory file
    twice instead of looking for a temporary file in `TMPDIR`, `/tmp`,
    `/var/tmp`, `/dev/shm` or `HOME`. Before, a process with no directory both
    writable and executable (a read-only container running as a regular user,
    for example) could not create callbacks: `Failed to allocate FFI closure`.
  - `ctypes.node` now imports `memfd_create` (glibc 2.27), within the glibc
    2.28 baseline of the Linux binaries; musl has had it since 1.1.20.

### Fixed

- **`ffi_closure` layout on macOS ARM64**: the generated `ffi.h` chose the
  layout of `ffi_closure` with `FFI_EXEC_TRAMPOLINE_TABLE`, a macro of
  `fficonfig.h` that it does not include. node-ctypes, and the libffi sources
  that include `ffi.h` first, saw a 48-byte closure with `cif` at offset 24,
  while the closure allocator and `ffi_prep_closure_loc` used the 40-byte
  layout with `cif` at 16, as the header generated by Autotools does. The
  header now tests the platform itself (macOS ARM64), so every source sees the
  same layout. Callbacks were not affected: node-ctypes only allocates a closure
  (48 bytes were enough) and never reads its fields.
- **`FFI_TYPE_LONGDOUBLE` where `long double` is a `double`**: the generated
  `ffi.h` kept it distinct from `FFI_TYPE_DOUBLE` everywhere, while libffi's
  `configure` makes them equal unless `long double` is larger (not on macOS
  ARM64 nor with MSVC). On AArch64 libffi would then have treated an 8-byte
  `long double` as the 128-bit type. The header now applies the same rule, from
  the compiler's `__LDBL_MANT_DIG__` and `__DBL_MANT_DIG__`. node-ctypes does
  not use `long double` yet, so nothing changes for existing code.

## [2.13.2] - 2026-11-15

### Fixed

- **libffi 3.8.1**: the submodule moves from upstream commit `d02afc25` to the
  v3.8.1 tag, with two fixes that node-ctypes could reach on ARM64:
  - a struct larger than 16 bytes (other than an HFA) passed by value after the
    integer registers, after a narrow stack argument on macOS (stack arguments
    are packed there) or with `_align_ = 16` elsewhere, had the pointer to its
    copy in a misaligned stack slot: the C function read another address and
    could crash ([GHSA-h52h-3759-xqm4](https://github.com/libffi/libffi/security/advisories/GHSA-h52h-3759-xqm4)).
    The tests skipped on Darwin ARM64 for this limitation run again;
  - on macOS ARM64, with more than 1024 live callbacks, some orders of
    `release()` wrote into a freed trampoline table
    ([GHSA-23hx-9rxv-9qfp](https://github.com/libffi/libffi/security/advisories/GHSA-23hx-9rxv-9qfp)).

  The other fixes of the release concern types node-ctypes does not expose
  (`long double`, vectors) or platforms and APIs it does not use. The generated
  headers report 3.8.1.

### Documentation

- **Guides**: the reference sections of the README moved, unchanged, to
  `guides/` (libraries and functions, types, structures, memory, callbacks,
  asynchronous calls, errors, Windows API, TypeScript, Python ctypes parity,
  building and testing), also published on the documentation site. The README
  keeps the quick start, the supported platforms and the list of guides. New
  pages: Getting started (installation, supported platforms, building from
  source), Coming from Koffi (the Koffi API mapped to node-ctypes) and
  Performance (results of the Koffi comparison, with charts, and how to run
  it). The paragraph on direct calls now describes the register-frame calls.
- **Benchmark charts**: `npm run bench:charts -- report.json` writes static
  SVG charts (ratio summary and one chart per workload group, light and dark)
  from the JSON report of `bench:koffi` or `bench:ffi` (`--output`), into
  `guides/images/` or the `--out` directory.

## [2.13.1] - 2026-11-14

### Fixed

- **Argument conversion order through the JavaScript wrapper**: as in CPython,
  where each argument goes through `from_param` and its C conversion before
  the next one, a scalar argument the native call rejects now fails before the
  converters of the later arguments run. Before, with `errcheck`,
  `use_last_error`/`use_errno`, `callAsync` or an object among the
  arguments, the `_as_parameter_` getters and `from_param` of the later
  arguments ran first and the error came afterwards. Values the call accepts
  as they are (integral numbers, booleans and BigInts for integers, numbers for
  floats, one-character strings for `c_char`/`c_wchar`) are checked in
  JavaScript; the others, objects included, by the native conversion itself
  (`checkArgument`), so the rules and the `ArgumentError` messages are those
  of the call. The native check returns the converted C value, so the
  conversion is complete before the next argument: a later adapter changing a
  Buffer passed to `c_char` no longer changes what C receives (as a
  `bytearray` in CPython); memory passed by address (a Buffer for a 64-bit
  integer) stays the original value. Scalar `CType` numbers as argtypes follow
  the same order. Too few arguments are still reported first, as
  "Expected N arguments, got M". The extra cost is a few nanoseconds per scalar
  argument converted by the JavaScript wrapper, and the native check for
  unusual values; calls through the native entry function are unchanged.
- **Flaky Executor test** (cancellation after an inline completion): on a
  loaded machine the inline waits expired, the per-function backoff then
  skipped the next ones and the 1 ms of inline completions per event loop turn
  was spent by the warm-up calls, so no attempt produced the inline completion
  the test needs. Each attempt now uses a new executor with the longest wait,
  started with another function, and a fresh event loop turn; when the machine
  is so loaded that the executor thread never runs within 10 ms, the test is
  skipped with that reason instead of failing. The attempts stop after 3 s, so
  the skip comes within the 5 s test timeout; a second test checks that the
  attempts without inline completions (`spin: 0`) stop at their time budget.

## [2.13.0] - 2026-11-14

### Changed

- **Register-frame calls instead of libffi**: synchronous calls of any
  signature of scalars, pointers and strings (up to 32 arguments) no longer go
  through libffi on AArch64, x86-64 System V and Win64. Each argument is
  converted straight into its register or stack word and one C++ signature per
  ABI passes the frame; before, libffi handled every signature with a pointer
  or a string and every one over four arguments. On x64 the call keeps the
  variadic register setup of libffi (AL on System V, doubles mirrored in the
  integer registers on Win64) for variadic functions declared with argtypes.
  Functions without argtypes and, on x64, variadic arguments use it too. On
  Apple ARM64 the stack arguments are packed by size and natural alignment,
  as the platform ABI (and libffi) lay them out; variadic arguments there
  stay with libffi.
- **Native functions returned by `CDLL.func()` and prototypes**: when the
  arguments need no JavaScript conversion (scalars, `c_char_p` strings) the
  returned function is the native one, as in Koffi, instead of a JavaScript
  wrapper; calls with objects (`CData` instances, buffers for `c_char_p`,
  `_as_parameter_`), with `errcheck` and the other signatures go to the
  JavaScript converters as before. The JavaScript wrappers shared V8 feedback
  across all functions, which made calls slower in programs using many of them.
  Visible differences for `CDLL.func()`: the function's `length` is 0 (it was
  the number of `argtypes` up to six) and its `name` is the C function's;
  `Function.prototype.toString` shows `[native code]` (prototypes too). Its
  properties (`errcheck`, `callAsync`, `callOn`, `address`, ...) are unchanged.
- **Fast path up to 32 arguments** (it was 8), reading the arguments with a
  capacity close to the declared signature (2, 4 or 8); primitive arguments
  pass through the JavaScript wrapper without conversion or copies.
- **Faster struct arguments**: structs passed by value take the fast path at
  any size (it was up to 16 bytes); libffi copies their bytes from the buffer
  before the call, as the general path did. A plain object of field values
  skips the generic parameter probes and the struct's Buffer is passed without
  a second conversion; `create`/`set` overrides, getters and field validation
  are unchanged. A `{x, y}` argument is about 20% faster, a four-double HFA
  argument about 30%.
- **Faster attribute calls** (`lib.name(...)`): a function already looked up
  is found with one lookup, before the library's own properties, and its
  arguments are forwarded without a rest array; a call through the attribute
  is about 30% faster. As in Python, where `__getattr__` stores the function
  on the library, a property defined later with the same name still replaces
  it, and `delete lib.name` now forgets the function: the next access returns
  a new one with no `argtypes`/`restype` (before, the same function).
- **Faster long string arguments**: strings that do not fit the 512-byte inline
  buffer are encoded straight into the reusable scratch of the function in the
  fast path, instead of retrying the conversion in the general path (three
  partial copies before the complete one). Strings of 600 bytes are about 30%
  faster, of 4 KB about 10-15%.
- **Faster pointer arguments**: each pointer position remembers the kind of
  value it received last (BigInt, Number, `null`/`undefined`, or a buffer for
  `c_char_p`) and reads that kind first, with one call to V8 instead of three;
  another kind takes the full conversion as before. An address passed as a
  BigInt or a Number is about 15-20% faster, `null` 5-10%.
- **Faster callbacks**: up to 64 callbacks running inside one synchronous call
  reuse its handle scope instead of opening one each (`napi_open_handle_scope`
  allocates); numeric results are converted with one read; after a callback,
  only the arguments that are JavaScript memory are checked for detachment.

### Fixed

- **gcc `-Wstringop-overread` warning** in the conversion of callback results:
  the helper that widens a narrow integer result was also instantiated for the
  types that fill the whole return word, and gcc 13 saw a read past the end of
  the value. Narrow results now have their own helper
  (`StoreNarrowIntegerValue`).
- **Flaky Executor test**: the coalescing test counted deliveries while the
  executor thread was still completing the burst, so a loaded machine produced
  more deliveries without any defect. Each call of the burst now marks its own
  byte and the JavaScript thread waits for every mark before yielding; the test
  fails with one delivery per call when coalescing is disabled.
- README: the Koffi version approved for the comparison benchmarks is 3.3.8.

### Added

- README: an `Executor` for many short calls kept in flight, with the reasons
  and the limits (one call at a time).
- Regression tests: many and nested callbacks in one call, out-of-range and
  non-finite Number results of integer callbacks, pointer arguments whose kind
  of value changes between calls, `_as_parameter_` adapters of structure
  arguments read once with their errors normalized, assignment and `delete` of
  library attributes, attribute functions with `use_last_error`, strings
  that fill the inline buffer followed by any `c_char_p` value, and results
  that point into long string arguments (with `errcheck` and reentrant
  calls); test fixture function `fixture_string_lengths_nullable`.

## [2.12.2] - 2026-11-11

### Fixed

- **`callOn` target lost during reentrant conversions**: the executor of a
  call was passed as ambient state just before `callAsync`; an argument
  adapter (`from_param`) that made another `callOn` overwrote and cleared it,
  and the outer call ran on the libuv pool. Each invocation now passes its own
  call object down to the native call (`FFIFunction.callOn`), also when an
  adapter calls the same function.
- **Cancellation of the wrong call**: the id of the call to cancel was read
  from the executor after the call returned; after an inline completion its
  errcheck may have queued other calls, and aborting the signal cancelled one
  of those. The native call now writes the id of its own job into the call
  object.
- **Abort during argument preparation ignored**: a signal aborted by an
  argument adapter was checked before the conversions and listened to only
  after submission, so the call ran. The native call checks the signal after
  preparing the arguments and before queuing the call, and rejects with
  `signal.reason` without running it.

### Changed

- **Coalesced completion notifications**: the executor thread notified the
  JavaScript thread once per completed call, while each delivery takes all the
  completed calls: in a burst most deliveries found nothing to do (10,000
  deliveries for 10,000 calls with `spin: 0`, all the promises settled by the
  first). It now notifies only when no delivery is pending (1 delivery in the
  same burst). Short calls cost about 25% less (sequential awaited calls about
  2.7 µs instead of 3.6 µs, bursts 2.4 µs instead of 3.2 µs, with a signal
  4.0 µs instead of 4.9 µs, locally on Windows x64).

### Added

- Regression tests for the three defects (thread identity of the call, nested
  calls on another executor and on the same function, cancellation after an
  inline completion, abort during preparation) and for the coalesced
  notifications; test fixture function `fixture_current_thread`.

## [2.12.1] - 2026-11-11

### Changed

- **Executor inline wait per function**: the JavaScript thread now waits for
  a call for about one and a half times the typical duration of its function
  (measured on every call; shorter durations weigh more, so a slow first call
  is forgotten in a few calls), at least `spin` and at most the new
  `spinLimit` option (microseconds, default 500, `0` for never more than
  `spin`); a function that usually takes longer is not waited for. Before, a
  single backoff per executor skipped the wait for every function after a slow
  call: a slow function alternated with fast ones (e.g. ADSI `GetColumn`
  with `FreeColumn`) sent the fast ones through the event loop too. On that
  pattern (one call of 65 µs and two fast calls) the overhead per round drops
  from about 47 µs to about 18 µs. The backoff is now per function: when its
  waits time out (e.g. where the executor thread wakes up slowly), a function
  skips the next 1, 3, 7, ... up to 1023 waits, without affecting the others.

### Fixed

- **Executor busy waits on a loaded machine**: the busy waits called
  `std::this_thread::yield()`, which, with other threads ready on the same
  core, gives the core away for a whole time slice: on a loaded machine (CI
  VMs running test files in parallel) each call cost tens of milliseconds, 401
  awaited calls 13 s instead of 0.13 s. The waits no longer yield, the
  executor thread polls for the next call for at most 50 µs whatever `spin`
  is, and the JavaScript thread stops waiting as soon as a native thread waits
  for it (a thread-safe callback invoked by the awaited call). Under load the
  fast path is now 3 to 5 times faster than `spin: 0`, as on an idle machine.

### Added

- **`Executor` `spinLimit` option**, and tests for the per-function wait
  (a function beyond `spin` within `spinLimit`, a slow function alternated
  with a fast one, a function that becomes fast again), checking the budget
  computed per function (independent of the speed of the machine); test fixture
  function `fixture_busy_wait_us`.

## [2.12.0] - 2026-11-10

### Added

- **`Executor` `spin` option** (microseconds, default 50, `0` disables, at
  most 10000): after a call the executor thread polls for the next one this
  long before sleeping, and the JavaScript thread waits this long for a call
  submitted to an executor with nothing queued, completing it without a round
  trip through the event loop. Awaited calls in sequence go from about 37 µs to
  about 4 µs each on Windows x64 (the same as a burst).
- **Tests**: spin option validation, awaited calls with and without spin,
  errcheck calling the same executor during an inline completion, slow calls
  falling back to the notification, thread-safe callbacks from the executor
  thread while the JavaScript thread waits, and immediates/timers running
  during awaited calls and bursts.

### Changed

- **Executor completions**: a call that completes within the `spin` budget is
  completed before `callOn` returns: its errcheck runs then and the promise is
  already settled (`await` still resumes asynchronously).
- **Event loop fairness**: inline completions are limited to 1 ms per turn of
  the event loop (a turn is detected by delivering a marker through the
  executor's thread-safe function); after that, calls are completed through
  the thread-safe function so that timers, I/O and UI events run, and a burst
  submitted in one go is queued instead of blocking the JavaScript thread.
  Waits that time out (slow calls) are skipped for the following calls, with
  exponential backoff up to 1024 calls, until one completes in time again.
- **Executor internals**: Node-API calls go through node-addon-api
  (`TypedThreadSafeFunction::NonBlockingCall`,
  `Error::ThrowAsJavaScriptException`, `Env::AddCleanupHook`); the executor
  thread signals its condition variable only when the thread is asleep.

## [2.11.1] - 2026-11-10

### Fixed

- **Worker termination during a call**: terminating a worker thread (or any
  environment shutdown) while a node-ctypes call was being prepared or
  completed could abort the process with `std::terminate` (an empty
  `Napi::Error`): Node-API can no longer throw a JavaScript exception there,
  and the C++ exception escaped the native callback.
  Such exceptions are now discarded during shutdown
  (`NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS`), and the executor and async call
  teardown paths no longer let C++ exceptions escape destructors or the
  completion callback.

### Added

- **Regression test**: workers terminated at random points while they make
  sync, `callAsync` and `callOn` calls.

## [2.11.0] - 2026-11-10

### Added

- **`Executor` and `fn.callOn(executor, ...args)`**: a native thread owned by
  node-ctypes with a FIFO queue. `callOn` is the same call as `callAsync`
  (conversions, out parameters, structures, variadic arguments, `errcheck`,
  argument lifetime), run on that thread instead of a libuv worker: calls run
  one at a time in arrival order and never occupy the libuv pool. Queued calls
  can be cancelled with an `AbortSignal` (`callOn({ executor, signal }, ...)`);
  `close()` waits for the accepted calls and stops the thread. Pending calls
  keep the process alive, an idle executor does not; on process exit or worker
  termination queued calls are discarded and a running call is detached.

### Changed

- **Asynchronous call internals**: the converted arguments of `callAsync` are
  held by a call object shared with `callOn`; the libuv worker only runs it.
  Behavior is unchanged.

### Documentation

- **Asynchronous calls**: document `callAsync` on the libuv pool, when to use
  an `Executor`, cancellation, `close()` and the process lifetime.

## [2.10.0] - 2026-11-06

### Fixed

- **Callback exception boundary**: a C++ exception other than a Node-API error
  (for example `std::bad_alloc` while copying an aggregate) raised while
  converting arguments or results, calling the JavaScript function, its error
  handler or the warning fallback is recorded and yields a zero result instead
  of crossing the native callback frame.
- **Callback snapshot pool isolation**: snapshots of callback arguments no
  longer share their pool with native-call temporaries. Since 2.9.0, detaching
  a snapshot's `ArrayBuffer` broke every later by-value structure argument and
  structure callback, and could let JavaScript read, alter or release memory
  still used by an in-flight native call. A detached pool is now replaced.
- **Detached buffer arguments**: a Buffer, typed array, DataView or ArrayBuffer
  argument detached while native code could still use it (by a callback during
  a synchronous call, or before a `callAsync()` completes) now makes the call
  throw or reject instead of returning silently. Node-API cannot prevent the
  detach; synchronous calls check only when a JavaScript callback ran.

### Documentation

- **Callback snapshot pool**: document the dedicated snapshot pool, how
  retention affects memory and why the underlying `ArrayBuffer` should not be
  exposed without copying.

## [2.9.0] - 2026-11-05

### Added

- **Backend-independent ABI regressions**: compiled C callers verify scalar
  aliases, narrow GP/FP stack arguments, small/large aggregates and homogeneous
  float/double aggregates for sync/async calls and ordinary/thread-safe callbacks.
  Include Darwin stack-slot coverage and a safe indirect-pointer alignment probe.
- **Koffi C-loop callback comparison**: check 64 consecutive i32 callbacks per
  native call with the same C fixture, reporting batch latency separately from
  the single-callback workload and normalizing both int64 results to Number.
- **node:ffi benchmark coverage**: expand to 25 workloads with narrow scalars,
  GP/FP stack arguments, C-loop/host-thread-safe callbacks and inferred calls.
  Document numeric bool normalization and explicitly typed inference counterparts;
  unsupported aggregate, variadic and async APIs remain not compared.

### Changed

- **Native backend source boundaries**: keep `src` flat and isolate
  `libffi_types`, `libffi_call` and `libffi_callback`, with concrete RAII-managed
  state and lazy descriptor caches. Common wrappers retain Node-API marshalling,
  selection and sync/async/TSFN ownership. Scalar/direct headers no longer depend
  on libffi; return-word compatibility is checked at compile time. CMake discovers
  native sources with `GLOB_RECURSE` and `CONFIGURE_DEPENDS`.
- **libffi upstream alignment**: temporarily pin the unmodified submodule to
  `d02afc25e8ea3aac9e78e227748e1fd7c9f14c82` for the Darwin small-composite
  stack-slot fixes and regenerate integration headers, pending an official tag.
  The indirect-pointer alignment defect remains tracked in
  [libffi/libffi#1057](https://github.com/libffi/libffi/issues/1057), without a local vendor patch.
- **Fixed sync/async preparation**: select direct invokers from finalized native
  metadata before preparing libffi types, CIFs or call plans; fixed workers reuse
  that selection and pin the parent function and library. Unsupported signatures
  retain eager libffi setup. Extra calls use cached sync or worker-owned async
  CIFs, prepared on the JavaScript thread without changing the fixed invoker.

### Performance

- **Inferred and variadic arguments**: bypass object conversion for primitive
  JavaScript extras and keep type/value metadata for up to 16 extras on the stack.
  Generic sync calls fuse inference/storage for leading numeric extras within
  16 total arguments. Preserve the eight-argument simple path, conversion order,
  scalar snapshots and ownership, with boundary, promotion, wide/non-finite
  number and reentrant-cache regressions.
- **Owned callback snapshots**: reuse the existing aligned JavaScript buffer
  pool for eligible high-level arguments, with independent, never-recycled
  slices; raw native and over-aligned arguments retain Node-API copies.
  Cache standard handlers and readers, not individual views, while respecting
  custom definition getters and mirrored synchronization.

### Known limitations

- **Darwin ARM64 indirect arguments**: libffi can misalign a large aggregate's
  indirect pointer after a narrow stack scalar. Temporarily skip the stack-tag
  regression only on Darwin ARM64 until an upstream fix is available.
- **Windows ARM64 variadic HFAs**: a named four-double HFA argument (32 bytes)
  crashes in upstream libffi. Temporarily skip its regression only on Windows
  ARM64, retaining coverage on other targets.
  This is not a runtime fix.

## [2.8.0] - 2026-11-04

### Fixed

- **Scalar argument marshalling**: read genuine non-pointer CData arguments from
  their backing bytes instead of overridden `.value` getters. Snapshot each
  scalar before converting later arguments, including calls without `argtypes`,
  matching CPython's conversion order.
- **Scalar adapters**: accept `from_param` results whose native scalar kind
  matches the declared type, even when the CData instance belongs to a different
  JavaScript class.
- **Examples navigation**: use explicit Electron and Cryptoki page titles
  instead of duplicate `README` labels in the generated documentation.

### Performance

- **Cached library symbols**: reuse attribute-function wrappers with a single
  cache lookup instead of separate `Map.has()` and `Map.get()` calls, preserving
  wrapper identity, signature changes and lazy symbol resolution.

## [2.7.0] - 2026-11-03

### Changed

- **Callback dispatch**: `callback()` and `threadSafeCallback()` invoke the
  JavaScript handler directly, like CPython's `tp_call`. Own `call` or `apply`
  properties on the handler are no longer consulted. The receiver stays
  `undefined` and the handler gets exactly the declared arguments.
- **Callback wrappers as arguments**: a `callback()` / `threadSafeCallback()`
  wrapper passes its own code pointer even through an object derived with
  `Object.create()` or a Proxy that redefines `_as_parameter_`. This matches
  CPython and `CFUNCTYPE` instances.

### Performance

- **Native entry point**: `FFIFunction` calls use a raw Node-API callback that
  reads up to eight arguments with one `napi_get_cb_info` and tries the simple
  call path before building a `Napi::CallbackInfo`.
- **Structures by value**: plain-object arguments of scalar-only `struct()`
  definitions are written by precompiled field writers into an off-heap
  transient buffer. Structures up to 16 bytes use the simple call path. Scalar-only
  results are read in place without a copy, unless `toObject` is overridden.
  Measured `{x,y}` argument: about 1.3x Koffi, down from 4.3x. Return: about 0.9x,
  down from 1.3x.
- **Argument owners**: synchronous calls keep conversion owners on a LIFO stack
  instead of a `Set`. Calls with one to three owner-bearing arguments skip
  intermediate arrays.
- **Callbacks**: wrappers are resolved through an internal brand. Handlers with
  up to three arguments are called without a rest array. Numeric results are
  converted with a single V8 read.
- **Variadic numbers**: classified and written to the argument slot with a
  single read.

## [2.6.0] - 2026-10-30

### Added

- **Native callback contexts**: opt into `suspend`, `resume` and `onError`
  hooks through the fourth `threadSafeCallback()` argument. Foreign callers
  detach their native state before waiting and restore it on the original
  thread before consuming an opaque error supplied with `setNativeError()`.
  Error payloads are isolated per invocation, including concurrent and nested
  calls.
- **Cooperative callback dispatch**: optional native `notify` hooks can wake
  the consumer's host runtime; `drain()` processes a snapshot of pending calls
  on the owning Node thread. Atomic claiming prevents duplicate execution
  between drains and TSFN delivery, and late deliveries do not access completed
  calls' native arguments. These primitives do not pump a blocked event loop
  automatically.
- **Electron + React example**: a real native system clock and process-ID check
  in `examples/cross-platform/electron-app`, with node-ctypes confined to the main process,
  typed sandboxed IPC and no renderer Node polyfill. Native `malloc`/clock/view/
  `free` reads exercise automatic synchronized mirrors when Electron disables
  external buffers. Local dependency packaging keeps the addon outside ASAR;
  real macOS ARM64 development and standalone packaged-app checks passed without
  an Electron-specific addon rebuild.

### Changed

- **Explicit native hook functions**: accept ctypes native function objects,
  low-level function handles and raw BigInt addresses. Resolve hook addresses
  once and retain supplied function objects through release and queued delivery
  cleanup. Plain JavaScript functions and known JavaScript-backed callback
  wrappers are rejected; native hooks bypass JavaScript converters and
  `errcheck`. Explicit library closure remains the consumer's responsibility.
- **Callback lifecycle**: represent validated native contexts with C++20
  `std::optional` and restore caller state through a noncopyable, nonmovable
  RAII scope, including a saved state equal to `nullptr`. Reject explicit
  release while a native-context invocation is active.
- **Public types and documentation**: expose the native-context options,
  error-transfer and drain methods, and native address metadata on library
  attribute functions. Document ownership, thread constraints and dispatch
  flows, with regressions for concurrency, reentry, GC and null-state
  restoration. Existing ABI-string options and callbacks without native
  contexts retain their behavior; the new hooks require a matching rebuilt
  addon, not only updated JavaScript wrappers.

## [2.5.0] - 2026-10-26

### Fixed

- **Portable CI validation**: large BigInt-to-float conversion no longer requires
  the floating-point `from_chars` overload introduced in macOS 26, preserving
  the macOS 13.5 deployment target and integer rounding/overflow checks. Paired
  Linux lookup tests accept musl's `libm` alias to `libc` and verify the resolved
  libraries by calling their correctly declared functions. Windows references
  resolve the explicit `msvcrt` library and accept absolute DLL paths instead of
  assuming CPython implements Node's `"c"` alias or returns bare file names.

### Changed

- **Parity tests**: migrate the complete former `common/` and `windows/`
  suites into domain-based `cpython_parity/` pairs, `node_specific/` regressions
  and genuine `python_specific/` scheduling checks. Paired JS uses Python-shaped
  classes, `ARRAY`, attribute bindings and `CFUNCTYPE`, with corresponding
  class/method IDs, input matrices and actual C signatures. A structural AST
  guard rejects one-sided files/cases, missing discovery markers and convenience
  APIs in the canonical pairs without adding dependencies or replacing either
  test runner. Python 3.15 CI now runs all references.
- **Pointer definitions**: expose Python's `_type_` metadata and defer incomplete
  aggregate pointee layout until an actual memory access, so forward-bound
  `_fields_` and self-referential types do not need manual cache invalidation.
- **Scalar and field conversion**: accept legitimate empty/whitespace field
  names without corrupting constructor/prototype metadata, and convert full-width
  BigInts to floating-point values with CPython rounding and overflow behavior
  rather than an artificial 64-bit integer limit.
- **Function protocols**: `CFUNCTYPE` callbacks are callable, native functions
  can be cast through the public API, and cached prototype conversion/retval
  hooks are captured at type creation. Pointer-to-pointer values use the pointer
  slot rather than the pointee bytes. Declared integer arguments reject nullish
  values, and string-pointer arguments require strings, compatible C-data or an
  explicit cast instead of an untyped integer address.
- **Raw memory and finalization**: explicitly sized `string_at` preserves all
  bytes, including invalid UTF-8 and embedded NUL, as a Latin1 string; unsized
  textual reads retain their UTF-8 representation. Address conversion errors
  retain their causes through `ArgumentError`. Materialized aggregate layouts
  reject `_fields_` reassignment, including previously incomplete types.
- **Typed pointer adapters**: match CPython's distinction between direct and
  adapted arguments. Automatic by-reference conversion, array decay and NULL
  acceptance no longer apply to scalar/array/null `_as_parameter_` results for
  `POINTER(T)`; explicit compatible pointers and `byref` results remain accepted.
- **Parameter resolution**: terminal primitive `_as_parameter_` results avoid
  allocating a cycle-detection Set. Recursive conversion follows CPython:
  stateful getters may revisit an object before terminating, and the fixed
  128-step rejection is removed. Non-terminating recursion uses the host runtime
  stack guard; intermediate owners stay alive and getter errors propagate unchanged.
- **Prototype callers**: eligible synchronous prototype bindings reuse the
  fixed-arity JavaScript wrappers used by library functions. Calls needing
  owners, custom adapters, result conversion or argument-count fallback keep
  the general pipeline. Hook snapshots, original argument arrays, callable
  metadata and prototype asynchronous behavior are preserved. External
  comparisons include explicit already-bound `CFUNCTYPE` caller rows.
- **Callback conversion**: builtin-only signatures skip the generic argument
  conversion dispatcher while preserving invocation and result conversion. Native
  handlers construct fallback error messages only on failure, with unchanged
  diagnostics and thread-safety checks.
- **Long UTF-8 arguments**: synchronous calls encode directly into reusable
  scratch storage when it fits, keeping the ordinary encoder for growth.
  String contents are still encoded on every call; the existing retention
  bound, wide-string alignment and independent reentrant buffers are preserved.
- **Structure argument conversion**: plain-object arguments for functional
  `struct()` definitions containing only builtin non-pointer scalar fields
  skip the transient Proxy and use the same byte initializer as `create()`.
  Field validation, zero defaults, dynamic `create()` / `set()` hooks and
  argument lifetimes are preserved. Classes and complex definitions keep
  their existing conversion paths.

## [2.4.0] - 2026-10-24

### Added

- **Release validation gates**: strict project C++20 compiler checks, Node 26
  functional-parity controls reusing the artifacts and focused Python 3.15
  references are wired into CI.
  The assembler requires every supported binary and includes release docs;
  publish waits for runtime gates, checks the exact version tag and sends
  prereleases to `next`.
- **External performance comparisons**: `npm run bench:koffi` and
  `npm run bench:ffi` compare the same C operations against Koffi and node:ffi.
  Tables show per-case medians, dispersion and time ratios from at least nine
  250 ms samples per library, with matching result representations. Koffi
  additionally covers aggregates, variadic calls and controlled async work.
  Every run generates a standalone responsive HTML report with bar charts,
  operation counts, measured times and environment/source metadata; optional
  JSON output includes all samples.
  The separate self-benchmark command has been removed.
- **Result protocols**: static `_check_retval_` runs on the restype representation
  before `errcheck` for library functions and prototype callers. OUT conversion
  uses `__ctypes_from_outparam__`; INOUT (`dir: "inout"` / flag 3) uses and
  returns the supplied instance without invoking the OUT hook.
- **Asynchronous output bindings**: `CFUNCTYPE` / `WINFUNCTYPE` bindings with
  `paramflags` expose `callAsync()`, `funcName`, `address` and `_ffi`, with
  the same output instances and `errcheck` return-args behavior as sync calls.

### Fixed

- **npm publication path**: explicitly prefix the downloaded tarball path with
  `./` so npm publishes the local package instead of interpreting the path as
  a GitHub repository shorthand and attempting an SSH connection.
- **Windows build diagnostics**: use compile-time guards for disabled floating-point
  direct invokers. Keep the required inline-buffer alignment and scope MSVC padding
  diagnostics to the affected class; waive upstream libffi's intentional unsigned
  alignment-mask negation only in its Windows ARM64 source file.
- **libffi header generation**: recognize `AC_PACKAGE_VERSION` as an Autoconf
  reference instead of reporting a false version mismatch, while retaining checks
  for conflicting literal version assignments.
- **Koffi installation policy**: explicitly approve only the reviewed Koffi 3.3.3
  install script in the private test package, eliminating the unreviewed-script
  warning without authorizing future dependency versions.
- **Narrow call-conversion tests across ABIs**: use matching C fixture
  signatures for narrow arguments/results instead of declaring `abs(int)`
  with incompatible 8/16-bit or boolean types. Preserve signedness, narrowing
  and boolean coverage without relying on unspecified register bits.
- **Library-view lifetime tests on musl**: preserve view/owner GC and logical
  close checks without assuming that `dlclose()` physically unloads a module.
  Probe the OS loader independently of `Library.close()` and reset fixture
  state between cases, since resident libraries keep their static data.
  Clarify the loader-dependent unloading contract in the API documentation.
- **Canonical test timeout**: test scripts use `--test-timeout=5000` before
  the file selector; the old trailing `--timeout` was not a valid runner
  option. `test:js` allows runtime controls to reuse the native artifacts.
- **Direct-call types**: native fast calls use exact scalar C++ signatures rather
  than treating register-class compatibility as function-type compatibility.
  Unsupported combinations and opaque pointer/string types use the existing
  cached libffi path. The signature set stays bounded and invokers retain
  internal linkage.
- **Callback return ABI and resources**: both callback handlers sign/zero-extend
  narrow integral results to a complete `ffi_arg`, including zero/error paths.
  Closure allocation uses a dedicated RAII deleter; partial thread-safe callback
  construction does not release an absent TSFN. `wchar_t`, `size_t` and `ssize_t`
  FFI descriptors now reflect native signedness and integer width.
- **Native callback types**: declarations include the existing `getPointer()`
  method, which validates that the callback has not been released.
- **Typed pointer arguments**: incompatible ctypes values are rejected before
  C entry, while compatible scalar/structure subclasses, arrays, explicit casts
  and documented raw-memory extensions remain supported. Recursive
  `_as_parameter_` chains retain intermediate owners and report cycles/depth
  limits, including after `from_param`.
- **Function pointer round-trips**: FFI callables can be stored back in pointer
  fields/arrays, passed to native functions and returned by pointer callbacks;
  bare JS functions still require explicit callback creation.
- **Scalar buffer factories and byref**: size/offset checks precede instance
  creation, derived copies bypass application constructors, and typed views
  are accepted. `byref(value, offset)` now applies signed byte offsets while
  preserving the original owner and pointee type.
- **OleDLL defaults and packing**: implicit restypes use HRESULT; explicit
  overrides remain effective. MS layouts accept `_pack_` zero and non-powers
  of two, reject explicit pack with GCC layout, and reject non-ABI alignments
  for by-value calls instead of preparing an invalid FFI description.
- **Scalar subclass representation**: C results and callback arguments preserve
  their bytes in derived scalar instances without calling application constructors
  or writers, including floating-point payload bits. Fields, arrays, pointer
  indexing and typed memory reads expose live derived instances. Builtin scalar
  fast paths retain ordinary JS values.
- **Result checking consistency**: explicit HRESULT validation applies to CDLL,
  WinDLL and prototype callers as well as OleDLL, before `errcheck` and outputs.
  Non-callable hooks and exceptions surface as errors/rejections.
- **Stable ABI descriptors**: captured native struct/union layouts and array
  elements are finalized recursively. FFI types retained by CIFs and call plans
  cannot be invalidated by later `addField()` calls. Open builders and size/
  alignment queries remain supported; finalized children do not prematurely
  finalize their outer builder. Native values use finalized layouts, reject
  short read buffers, and direct by-value recursion is rejected.
- **Independent function results**: returned functional `struct()` / `union()`
  values now own their bytes before JavaScript conversion. Array views, nested
  unions and union getters no longer alias the native function's reused result
  buffer, including during reentrant conversion or `errcheck`. Class results
  retain their single JS snapshot. Sync and async callers, library attributes,
  prototypes and output bindings keep their existing public result shapes.
  Explicit `toObject(buffer)` views and borrowed native result buffers are
  unchanged; pointer targets are not deep-copied.
- **Primitive conversions**: negative unsigned arguments and integers outside
  the signed 64-bit range wrap without adding `2**64` in floating point or
  casting an out-of-range floating value to an integer. Fast, generic, async
  and native slot conversions agree, including boolean and BigInt inputs.
- **Wide-character calls**: `c_wchar` uses the validated wchar converter in
  the simple path, not pointer/string marshalling. Simple argument types are
  explicitly enumerated; unsupported variadic types fall back before use.
- **Endian arrays**: primitive arrays in big-endian structures and unions
  use the correct byte order, including multidimensional, float and wchar
  arrays, serialization and mirrored native memory. Shared native/LE array
  types are unchanged; nested structure elements keep their own byte order.
- **Boolean values**: bool bitfields normalize before masking, return booleans
  and preserve adjacent fields according to C. False scalar instances remain
  false for `c_bool` and `VARIANT_BOOL`; VARIANT_BOOL arguments, fields,
  results and callbacks use the same boolean / `-1` representation.
- **Scalar validation**: constructors, value setters, arrays and bitfields
  no longer coerce numeric strings, arbitrary objects or null to numbers.
  Constructors still default to zero for omitted/undefined values, and
  documented 64-bit numeric pointer/null arguments remain supported.
  Incompatible scalar instances are rejected in declared numeric arguments
  and fields. Floating-point BigInt conversions have the same range checks
  in JS and native code; long and ssize_t bitfields are signed.
- **Array type retention**: array types are weakly interned by element type
  and length, with finalized entries removed from the cache. Builtin element
  types no longer retain every array length ever requested. Live instances,
  signatures and containing types preserve type identity and validity.
  Internal byte-array wrappers used for native layouts follow the same
  policy; live native layouts retain their underlying metadata.
- **Errcheck lifetime and snapshots**: self-referencing hooks no longer keep
  abandoned functions, libraries and callbacks alive. Each invocation captures
  its hook before adapters or getters run, including raw native handles and
  asynchronous jobs; replacing, clearing or adding a hook affects later calls.
  Public prototype hooks receive the public callable, not a native handle.
  Invalid hook assignments preserve the previous valid hook.
- **Output binding isolation**: `paramflags` bindings no longer inherit hooks
  from an unrelated cached function. Adapter temporaries and active-call
  protection extend through `errcheck` and output processing, synchronously
  and asynchronously, while explicit HRESULT validation still runs first.
- **Pointer views and typed copies**: pointers read from fields, arrays and
  double indirections retain their known owners. Borrowed views, pointer-slot
  buffers and address-backed aliases share the appropriate ownership, even
  if the original pointer is repointed. Typed structure/union/array copies
  preserve references across overlapping and self-copies; overwriting
  pointer storage releases the replaced references. Raw memory copies do
  not infer or transfer ownership.
- **Exported global lifetime**: `in_dll()` views and their dependent buffers,
  pointers and typed copies keep the native module loaded independently of
  the library wrapper. `close()` immediately closes the logical handle,
  rejects subsequent bound calls and symbol lookups, and defers physical
  unloading until the dependent memory is no longer needed. This also
  makes closing a current-process handle logically effective.
- **Argument conversion lifetime**: objects and temporaries unwrapped by
  `from_param` / `_as_parameter_` remain alive while later arguments are
  converted and through result conversion and `errcheck`, including
  `callAsync()`. The same behavior applies to library attributes and
  `CFUNCTYPE` / `WINFUNCTYPE` callers, without allocating ownership frames
  for ordinary numeric calls.
- **Native asynchronous arguments**: copied structures and arrays,
  values produced by getters, inferred C-data arguments, and buffers passed
  as integer addresses are retained until the worker finishes. Library
  closure is also rejected while native getters materialize the arguments;
  worker setup and queue failures release their resources.

### Changed

- **Prototype identity**: `CFUNCTYPE` / `WINFUNCTYPE` reuse live prototypes by
  complete type identity and calling convention through weak-value interning.
  Live callers/callbacks/output bindings retain their prototype. Public
  metadata is shared but does not mutate the captured native signature or
  cache key. New caller bindings capture fresh adapters/retval hooks and
  retain independent `errcheck` state.
- **Comparison summaries**: Koffi / `node:ffi` scripts no longer
  combine unrelated workloads into an average ratio or winner count.
- **Memory operation results**: `memmove()` / `memset()` return the destination
  address as BigInt instead of undefined. JS-memory clipping is preserved;
  address caching excludes resizable/growable stores and detects detachment.
- **API declarations**: callback arguments include typed pointers and scalar
  instances; unsupported callback return types remain rejected. Prototypes
  retain argument/return types and async metadata, and native descriptor/
  callback declarations now match their runtime members.
- **Derived scalar return types** now produce instances, as Python ctypes does.
  TypeScript infers those instances and `_check_retval_` return types without
  widening builtin values; INOUT directions are included in `ParamFlag`.
- **Native descriptor mutation**: `StructType.addField()` now throws after
  the layout is acquired by a field, array, prepared signature or native
  value. Construct a new descriptor to change its layout. This includes
  aggregate array elements of length zero and descriptors used by callbacks.
- **TypeScript function pointers**: prototype callers and output bindings
  expose the full `FFIFunction` interface. Low-level hooks use
  `NativeErrcheckCallback`, whose `func` argument is a native handle rather
  than a directly callable function. Corrected the output-binding example
  to use the actual `GetWindowThreadProcessId` signature.

## [2.3.0] - 2026-10-23

### Fixed

- **`threadSafeCallback()` called by several native threads at the same
  time**: the calls shared one result slot, so a thread could receive the
  result of another call or wait forever. Each call now waits for its own
  result; a call whose JavaScript function throws returns `0` instead of a
  previous result.
- **Functions keep their library loaded**: a function obtained from a
  `CDLL` (or with `CFUNCTYPE(...)([name, lib])`) no longer crashes when the
  library object is garbage-collected. After `close()` its calls throw
  `Library is closed`, and `close()` throws while a call to one of its
  functions is in progress (from a callback, or a pending `callAsync()`).
- **Reentrant calls**: a function called again from a callback during its
  own call overwrote the string arguments of the outer call.
- **Memory growth**: strings passed to `c_void_p` parameters accumulated in
  an internal buffer that was never cleared.
- **Structure and union layout follows Python ctypes** (`ctypes._layout`):
  bit fields of different types share storage units as with GCC
  (`"gcc-sysv"`, the default except on Windows) or MSVC (`"ms"`, on Windows
  and with `_pack_`); before, a bit field of a different type always started
  a new unit, so mixed bit fields had a different size and offsets than in
  C. Checked byte by byte against Python ctypes.
- **Subclasses of structures and unions**: a subclass with `_fields_` reused
  the layout of its base once the base had been used, so its own fields were
  missing; it now extends the fields of the base, which keep their offsets,
  as in Python. A subclass without `_fields_` has the layout of its base.
- **Bit fields**: 32-bit wide fields read back as 0, and 64-bit fields wider
  than 53 bits lost precision. Fields wider than 53 bits now read as BigInt.
  Bit fields of big-endian structures are laid out from the big end, as in
  Python.
- **`BigEndianStructure` / `BigEndianUnion`**: `get()`, `set()` and
  `toObject()` used little-endian (field access was already correct).
- **Objects assigned to fields of nested structures** (strings, pointers,
  callbacks) were kept alive only by the temporary nested view and could be
  collected while the outer structure still pointed to them; they now live
  with the memory of the outer structure, as Python `_objects`.
- **Structures by value**: structures with bit fields, subclasses, `_align_`
  and arrays of structures (`Cannot assign to read only property '_native'`)
  are passed and returned with the layout of the JS definition.
- **Array parameters** (`argtypes = [c_int32 * 4]`) were passed by value,
  as a structure of N elements, so the C function received the bytes of
  the array as its pointer; they are now passed by address, as in C and
  Python. As in Python, only an array of the same element type and length
  (or a Buffer / typed array) is accepted, other values raise
  `ArgumentError`.
- **`errcheck` of functions with `paramflags`** was never called. It now
  receives `(result, func, args)` with the out-params as instances, and its
  return value is the result unless it returns `args`, as in Python.
- **Invalid native types no longer terminate the process**:
  `StructType.addField()` / `ArrayType` with an invalid type, a negative or
  fractional array length and a zero-length `char` array initialized from a
  string threw uncaught C++ exceptions or crashed; they now throw JS errors
  (and any C++ exception becomes a JS error). Fields of
  `StructType.create()` objects could not be assigned.
- **`use_errno` / `use_last_error`** only read `errno` / `GetLastError()`
  after the call. As in Python, the value set with `set_errno()` /
  `set_last_error()` is now the system value during the call, and the
  system value is restored after it (also with `callAsync()`).
- **Wide strings with characters outside the BMP** (emoji, ...) were passed
  as UTF-16 code units where `wchar_t` is 32-bit (Linux, macOS): `wcslen("a😀b")`
  was 4 instead of 3. Surrogate pairs now become one `wchar_t`; lone
  surrogates are kept, as in Python. `wstring_at()` keeps lone surrogates
  instead of replacing them with U+FFFD.
- **`c_wchar` arguments** accepted any string (using its first code unit);
  as in Python they must be exactly one character.
- **64-bit and pointer-sized integer arguments** (`c_int64`, `c_uint64`,
  `c_size_t`, `c_ssize_t`) silently passed `0` for strings, symbols,
  functions and plain objects; they now raise `ArgumentError`. `null` (0)
  and Buffer / ArrayBuffer (their address) are still accepted.
- **`errcheck` of library attributes** (`libc.abs.errcheck = ...`) was set
  on the function shared by `func()` calls with the same signature, and was
  lost when `argtypes` / `restype` changed. Each attribute now keeps its
  own function and its `errcheck`, as in Python.
- **`func()` cache**: functions with the same signature but different
  options (`abi`, ...) shared one cache entry.
- **`OleDLL`**: each `func()` call returning a cached function added another
  HRESULT check on top of its `errcheck`, and setting `errcheck` removed the
  HRESULT check. As Python `HRESULT._check_retval_`, the check now runs
  before `errcheck` and is not replaced by it.
- **`from_param`** was called after the default conversion of the argument
  (so it received a Buffer instead of the object passed) and was ignored by
  `CFUNCTYPE` prototypes. As in Python it now receives the argument as
  passed, for `CDLL` functions and prototypes, and its errors raise
  `ArgumentError` (`argument 1: RangeError: ...`).
- **`memmove()` / `memset()`** crashed with a `Uint8Array` that is not a
  Buffer and rejected other typed arrays, `DataView` and `ArrayBuffer`;
  these are now accepted as bytes. `memset()` stops at the end of JS memory
  as `memmove()` does, instead of throwing.
- **`find_library()` on Linux** could return the 32-bit library of a
  multiarch system, and never found versioned sonames outside the ldconfig
  cache. As Python it returns the soname of the library with the ABI of the
  process, then the highest version found in the library directories.
- **Integer values wrap to the bits of the type**, as in Python, instead of
  throwing `RangeError`: `new c_uint8(256).value === 0`,
  `new c_uint64(-1).value === 2n ** 64n - 1n`, also for structure fields
  and array elements.
- **Structures with `_pack_` by value**: the native description placed the
  fields at their natural offsets, so the C function received a different
  layout. The fields now keep the offsets of the JS layout (misaligned ones
  as bytes), and on x86-64 System V a structure with misaligned fields is
  passed and returned in memory, as GCC and clang do (Python ctypes uses
  registers there). Padding of structures with bit fields is no longer
  passed as bytes, which moved a `float` that shares an eightbyte with
  padding from an SSE register to an integer register on x86-64.
- **Native types are recognized by their instances**: `StructType`,
  `ArrayType` and `Library` objects were recognized by the names of their
  methods, so a JS object with the same methods reached the native code and
  failed with an unclear error. Their instances are now marked with a
  Node-API type tag; other values raise a `TypeError` (`Type must be a CType
enum value (number), StructType or ArrayType`). Invalid types of
  functions, callbacks, fields and arrays raise `TypeError` everywhere.
- **Arguments of a type that cannot be converted** left their slot
  uninitialized instead of raising `ArgumentError`.
- **Errors of a callback result conversion** no longer cross C frames: the
  callback returns 0 and the error is reported as other callback errors.

- **Callback lifetime**: a `threadSafeCallback()` collected by the GC while
  calls were still queued freed memory that the queued calls used; a
  `callback()` called from another thread (for example by a function run with
  `callAsync`) ran JavaScript off the main thread. The first now keeps its
  state until the last queued call, the second records an error and returns 0
  (use `threadSafeCallback()` for other threads).
- **Pointers** (Python parity): `byref(p)` / `addressof(p)` of a `POINTER`
  instance give the address of the pointer itself (a `T**` output parameter
  wrote past the target); `cast()` and `p.add()` keep the source alive;
  `p.contents = x` rejects an instance smaller than the pointed type;
  `cast(c_char_p(...), POINTER(c_char))` reads the stored address;
  `pointer(array)` points to the array.
- **`cast(x, c_void_p | c_char_p | c_wchar_p)`** read the bytes of `x` as a
  value: it now returns an instance pointing to `x` (kept alive), as Python.
- **Structure arguments**: a plain object is converted to an instance of the
  structure; an array is rejected (Python rejects a tuple).
- **Variadic arguments**: typed instances (`c_int8(1)`, `c_float(1.5)`, ...)
  are passed with the C default promotions; typed arrays as pointers.
- **`_fields_`**: entries keep their order also for integer-like names;
  duplicate names and malformed entries raise `TypeError`. `struct()` accepts
  a Structure/Union class as anonymous field; `Union` supports `_anonymous_`
  (also nested).
- **Callbacks with `c_char_p` / `c_wchar_p` restype** can return a string
  (it is kept alive with the callback, as Python does).
- **Library loading**: on Windows `LoadLibraryExW` (UTF-8 paths) with the
  flags of Python (`LOAD_LIBRARY_SEARCH_DEFAULT_DIRS`, plus the directory of
  the library when the name is a path), without changing the DLL search path
  of the process; `GetProcAddress` errors no longer say `LoadLibraryExA`. On
  POSIX symbols are resolved at load time (`RTLD_NOW`), as Python.
- **`find_library()` on macOS** finds libraries and frameworks in the dyld
  shared cache (`/usr/lib/libc.dylib`, `CoreFoundation.framework`), searching
  Homebrew first as Homebrew's Python.
- **`string_at()` / `wstring_at()`** returned `null` for instances, arrays,
  pointers, `c_char_p`/`c_void_p` and `_as_parameter_`; they read their
  memory as Python. Strings (also `c_char_p.value`) are no longer truncated
  at 1 MiB.
- **`readValue()` / `writeValue()` / `sizeof()`** accept addresses, ctypes
  instances and typed arrays for every type, with bounds checks.
- **`c_void_p` fields** accept pointers created from an address,
  `_as_parameter_` and `c_char_p` instances, and keep assigned memory alive.
- **`array(struct({...}), n)`** (and `union()`) failed in the native layer.
- **`Structure.from_buffer()`** accepted negative offsets; it now validates
  them as Python and accepts typed arrays and ctypes instances.
- **`String(cdll)`, `JSON.stringify` and other probes** of the lazy loaders
  tried to load a library named `toString`, `toJSON`, ...; names starting
  with `_` are not libraries, as in Python.
- **`f.argtypes = null`** and **`f.errcheck = undefined`** threw.
- **Unions by value on x86-64 System V** were passed in the wrong registers
  (libffi has no union type, libffi#33; CPython has the same bug): each
  eightbyte now gets the class of all the members that cover it.
- **Silent acceptances where Python raises**: too many positional
  initializers (`TypeError: too many initializers`), an instance of another
  type assigned to a field (`incompatible types`), a Buffer too long for a
  `c_char * n` field (`bytes too long`), bit fields of non-integer types
  (`bit fields not allowed for type c_float`). A `SimpleCData` instance is a
  positional initializer (`P(c_int(5))`). `array(c_char, n).create("héllo")`
  encodes UTF-8 as `.value`.

### Added

- **`_layout_` and `_align_`** on structures and unions, as in Python ctypes.

- **Structures and unions by value as callback arguments**, as in Python;
  a structure restype of a callback raises `TypeError: invalid result type
for callback function` at creation, as in Python.
- **`winmode`** option of `CDLL` (Windows `LoadLibraryExW` flags), as Python.
- **`pack`, `layout`, `align` options** of `struct()` / `union()`;
  `union()` and `defineUnion()` accept options.
- **`WinError(code, descr)`** has `errno` (mapped from the Windows code as
  Python's `OSError`) and `strerror`.

### Changed

- **Non-integral numbers for integer types raise `TypeError`** (`'float'
object cannot be interpreted as an integer`), as Python does for floats:
  arguments (`ArgumentError`), constructors, fields, bit fields and callback
  results. Integral numbers outside the range of the type wrap as before
  (64-bit values no longer saturate).
- **Array methods work on the elements**: `slice`, `at`, `indexOf`,
  `includes`, `forEach`, `map`, `fill`, `join`, `entries`, ... on an array
  instance use the elements (Python sequence operations), not the bytes of
  the Buffer; slices of `c_char`/`c_wchar` arrays are strings and
  `JSON.stringify` gives the elements. Buffer methods (`readInt32LE`,
  `subarray`, ...) still work on the bytes.
- **`POINTER(T)` and `array(T, n)` are cached**: the same type object for
  the same arguments, as in Python.
- **`errcheck` receives the function itself** (`func === lib.abs`) for every
  restype, as in Python; it was the native wrapper for simple restypes.
- **Typings**: statics `size` / `alignment` / `fields` of Structure classes,
  classes returned by `defineStruct()` / `defineUnion()` with their statics,
  element-wise array methods, narrower element types of `array()` /
  `bitfield()`, typed arrays and addresses in `readValue()` / `writeValue()`.

- **Structure/Union fields are accessors of the class** instead of a
  `Proxy` around each instance (Python: fields are descriptors of the
  class). Field reads and writes are about 5 times faster (about 4 ns
  instead of 20-25 ns). `Object.keys(s)` and `{ ...s }` no longer list the
  fields: use `s.toObject()`; `JSON.stringify(s)` (new `toJSON()`) and
  `console.log(s)` show them.
- **A nested structure or union field is an instance of its class**
  (Python parity) on the memory of the outer instance, instead of a
  `Proxy` view: `rect.a instanceof POINT`, and its methods and `toObject()`
  are available. The instance is created on the first access and reused
  (`rect.a === rect.a`), so `rect.a.x` takes about 6 ns instead of 170 ns.
- **Faster calls** (measured on macOS arm64 against the previous version):
  - functions with fixed numeric, pointer or string arguments and a result
    that is not an array go through a dedicated path without the general
    call state: `abs` / `sqrt` about 25% faster, `memset` with a Buffer
    about 40%;
  - numeric arguments take one Node-API call instead of two, and a Buffer
    or typed array passed as a pointer one instead of three;
  - variadic calls (`sprintf`) about 15% faster;
  - structures returned by value about 2 times faster: the bytes are
    returned in a Buffer reused by the function instead of a new one per
    call;
  - writes of 64-bit integer values given as numbers (`c_int64`,
    `c_uint64`, `c_size_t`, `c_long` fields and `.value`) about 4 times
    faster.
- **Benchmark 7** (`tests/benchmarks/benchmark_koffi.js`) measured reads of
  two plain JS objects; it now measures structure fields in memory and a
  structure returned by value.
- **Error messages follow Python 3.14+ ctypes**: `c_char` / `c_wchar`
  values (`one character bytes, bytearray, or an integer in range(256)
expected, not a string of length 2`, `a unicode character expected, ...`),
  pointer arguments (`'function' object cannot be interpreted as
ctypes.c_void_p` instead of `wrong type`) and numeric arguments
  (`'string' object cannot be interpreted as an integer`, `must be real
number, not string`).
- **`ArgumentError`** accepts the `options` of `Error` (`{ cause }`).
- **Python reference tests run in CI** (Python 3.14, with `unittest`; no
  longer `pytest`).
- **A Structure/Union `restype` returns an instance of the class** (Python
  parity) instead of a plain object; `errcheck` receives the instance. A
  `struct()` definition as `restype` still returns a plain object.
- **Tests**: `npm test` builds a C test library (`tests/fixtures/`) for
  structures by value, array parameters and reentrant calls; its Python
  twin tests check the same behavior with Python ctypes.
- **C++20 cleanup of the native module**: concepts for the wrapper classes
  and the direct-call invokers, `constexpr` type helpers, `[[nodiscard]]`
  results, one parser for native types and one for callback signatures.
  Values in raw memory (libffi results, C memory) are read with one
  `LoadAs<T>` helper instead of a union whose inactive members were read
  (undefined behavior in C++); buffers are passed as `std::span` /
  `std::wstring_view` with their size.
  The descriptors of structures, unions and arrays (`StructInfo`,
  `ArrayInfo`) are in `src/layout.h` / `layout.cc`, separate from their JS
  wrappers (`StructType` in `struct.h`, `ArrayType` in `array.h`).
- **Build**: the native module is compiled as standard C++20 without
  compiler extensions (`-std=c++20` instead of `-std=gnu++20`) and with
  warnings enabled (`-Wall -Wextra`, `/W4`); it builds without warnings.

## [2.2.0] - 2026-10-22

### Added

- **Embedded Python example**: `demo_python_cryptography.js` uses
  pyca/cryptography (hashes, HMAC, RSA, EC and DSA keys and signatures, an
  X.509 CSR and a self-signed certificate) and checks every result with
  `node:crypto`.
- **Embedded Python example**: `Python.initialize({ stdout, stderr })` writes
  Python's output through `process.stdout` / `process.stderr` (`"node"`, in
  order with `console.log`) or captures it with a function; in Electron,
  `toTypedArray()` falls back to a copy.
- **`EXTERNAL_BUFFERS`**: `false` where the runtime does not allow Buffers
  over native memory (Electron). Detected when the native module loads
  (`napi_no_external_buffers_allowed`), not from the runtime name;
  `NODE_CTYPES_NO_EXTERNAL_BUFFERS=1` forces the mode on Node.js.
- **`from_buffer()`, `from_buffer_copy()` and `from_address()` on array
  types**, as in Python: `array(c_uint8, n).from_address(addr)` is an
  array on the memory at `addr`, and its `_buffer` a Buffer over it (the
  equivalent of `memoryview((c_ubyte * n).from_address(addr))`).

### Removed

- **`ptrToBuffer()`** is no longer exported. Python ctypes has no
  such function, and the same view is
  `array(c_uint8, size).from_address(address)._buffer`. To read or write a
  value at an address use `T.from_address(address)` or a `POINTER(T)`; to
  copy bytes, `memmove(Buffer.alloc(n), address, n)`.

### Fixed

- **Electron**: `from_address`, `in_dll`, `pointer.contents`, `p[i]`,
  `cast` and `memmove` / `memset` with addresses failed with "External
  buffers are not allowed". Without external buffers, instances on native
  memory now work on a copy: each read refreshes the bytes of the field and
  each write copies them back, with one native call (about 50 ns);
  instances on ordinary Buffers have no extra cost. Passed to C functions,
  `addressof()`, `pointer()` and `memmove()` / `memset()` they use the
  original address. On Node.js nothing changes.
- **`memmove()` / `memset()` with addresses** copy through the native module
  instead of creating a Buffer over the memory.

### Performance

- **Writes through a pointer to an address** (`p[i] = v`,
  `p.contents = v` for simple types) copy the value with the native module
  instead of creating an external Buffer at each write: `p[i]` read + write
  goes from ~715 ns to ~350 ns.
- **Nested structures and arrays** reuse their Proxy handler instead of
  creating one at each field access.

## [2.1.1] - 2026-10-22

### Fixed

- **`callAsync()` with `use_errno` / `use_last_error`**: the call runs on a
  worker thread and its `errno` / `GetLastError()` were not captured, so
  `get_errno()` / `get_last_error()` returned a previous value. They are now
  read on the worker thread right after the call and published before
  `errcheck` runs, as for synchronous calls.
- **`errcheck` with `callAsync()`** received an empty `args` array; it now
  receives the arguments of the call, as for synchronous calls.

### Changed

- **Embedded Python example requires Python 3.12+** (was 3.8+): it uses only
  the stable C API of Python (`Py_CompileString` / `PyEval_EvalCode` instead
  of `PyRun_String`, `PyErr_GetRaisedException` / `PyErr_SetRaisedException`
  instead of the deprecated `PyErr_Fetch` triple), and older interpreters get
  a clear error.

## [2.1.0] - 2026-10-22

### Added

- **`threadSafeCallback().ref()` / `.unref()`**: like a timer, a thread-safe
  callback keeps the event loop alive until released; `.unref()` lets the
  process exit when nothing else is pending, while calls from other threads
  are still delivered. Both return the wrapper.
- **Embedded Python example** (`examples/cross-platform/python`): CPython
  driven through its C API with node-ctypes, on Windows, macOS and Linux
  (glibc and musl), Python 3.8+ including free-threaded builds, hosted by
  the main thread or by a worker thread. It runs code and imports modules
  and packages (local `.py` files and numpy too), converts values both ways
  (dict keys as properties, `Tuple`, `Date` ↔ `datetime`, `Temporal` types
  on Node.js 26+), uses JavaScript objects from Python by reference
  (`JsProxy`, `byReference()`), shares memory between typed arrays and
  Python buffers without copies, and implements `with` / `async with` and
  time limits. asyncio is connected to the Node.js event loop with an
  unreferenced `threadSafeCallback`: coroutines are awaitable from
  JavaScript, coroutines and Python threads call JavaScript functions (also
  while synchronous Python code waits for them, without deadlocks), and
  async iterators and cancellation work in both directions. `stats()`
  counts the objects shared by the two languages.
- **A README for every example**, published as child pages of the Examples
  document in the API documentation.

### Changed

- **Examples are organized by platform and example**
  (`examples/cross-platform/`, `examples/macos/`, `examples/windows/`), one
  folder per example with its library, demos and README;
  `examples/README.md` is an index. The COM demos are renamed
  `windows/com/demo_com_shortcut.js` and
  `windows/com/demo_com_active_directory.js`.

### Fixed

- **Smart card example on Linux**: `libpcsclite.so.1` is loaded by soname
  (the library is in the multiarch directory), `SCardError` codes are
  unsigned 32-bit numbers (`c_long` results are BigInt), and listing readers
  returns `[]` when none is connected (`SCARD_E_NO_READERS_AVAILABLE`).

## [2.0.0] - 2026-10-21

2.0 aligns node-ctypes with Python ctypes as closely as the language allows,
so that Python code can be ported with only the changes JavaScript requires.
It contains breaking changes: see [Migrating from 1.x](guides/python.md#migrating-from-1x).

### Breaking changes

- **`pointer.contents` returns a live instance** on the pointed memory, as in
  Python: `p.contents.value` for simple types, `p.contents.x` for structures.
  Assigning an instance re-points the pointer; assigning a plain value writes
  it. `p[i]` still returns the value (a live instance for structures).
- **`POINTER(T)` restype returns a pointer object** (`null` for NULL) instead
  of a `bigint` address; use `.address` for the number. A `CFUNCTYPE` restype
  returns a callable function.
- **NULL `POINTER` fields of structures and unions read as `null`.**
- **`c_char` values are 1-character strings** (Python `bytes` of length 1)
  instead of numbers; `c_wchar` values are 1-character strings.
  `c_char * n` / `c_wchar * n` fields read and write as strings.
- **Invalid `c_char` / `c_wchar` values raise `TypeError`**
  (`"one character bytes, bytearray or integer expected"`,
  `"one character unicode string expected"`) instead of being truncated.
- **Argument conversion errors raise `ArgumentError`** (a `TypeError`
  subclass) with the Python message `"argument N: TypeError: ..."`. Numeric
  arguments accept numbers, booleans and BigInt (truncated to the type, as
  Python masks integers) and reject strings, `null` and objects.
- **Values that are not pointers raise `ArgumentError` (`"wrong type"`)** for
  pointer parameters instead of passing NULL (JS functions, plain objects,
  symbols). Invalid values assigned to pointer fields raise `TypeError`
  instead of writing 0.
- **Functions without `restype` return `c_int`**, and calls without
  `argtypes` use the fixed-argument ABI with Python's default conversions
  (e.g. a `c_int(5)` instance is passed by value).
- **`c_long` / `c_ulong` are `BigInt` on every platform**: fields and
  `.value` on Windows (where `long` is 32-bit) were numbers, while function
  results were already `BigInt`. This includes `wintypes.BOOL`, `LONG`,
  `DWORD`, `ULONG`, `LSTATUS`, `COLORREF`. Writes accept numbers and BigInt.
- **`wintypes` follows Python's `ctypes.wintypes`**: `CHAR` is `c_char`
  (was `c_ubyte`); `LPDWORD`, `PDWORD`, `LPBYTE`, `PBYTE`, `PHKEY` are
  `POINTER(T)` (were `c_void_p`), so fields and results of these types are
  pointer objects.
- **`string_at(addr, n)` / `wstring_at(addr, n)` read exactly `n` units**,
  embedded NULs included, instead of stopping at the first NUL.
- **`create_string_buffer(init, size)` / `create_unicode_buffer(init, size)`**
  honor `size` (`RangeError` if `init` does not fit) and return Buffers with
  `.value` (and `.raw` for char buffers).
- **`array(type, n)` returns a callable type** (a function, as Python's
  `type * n`) instead of a plain object.
- **Structure/union instances assigned to nested fields are copied
  bytewise**, as in Python, instead of field by field.
- **TypeScript declarations** follow the new runtime types (see below).

### Added

- Prebuilt binaries for Linux with musl (Alpine), x64 and ARM64
  (`ctypes-linux-<arch>-musl.node`), selected automatically.
- Python names: `ArgumentError`, `ARRAY`, `c_buffer`, `c_voidp`, `c_time_t`,
  `SIZEOF_TIME_T`, `RTLD_GLOBAL`, `RTLD_LOCAL`, `DEFAULT_MODE`,
  `LibraryLoader`, `cdll.LoadLibrary()` (and `windll` / `oledll`),
  `get_last_error()` / `set_last_error()` (on every platform), `CType.CHAR`.
- `CDLL(name, mode)` and `CDLL(name, { mode })` with the `dlopen` flags.
- Array types are callable like Python's: `array(c_int, 3)(1, 2, 3)` (also
  with `new`); arrays of arrays, of `POINTER(T)` and of `CFUNCTYPE` types;
  `.value` / `.raw` on `c_char` arrays and `.value` on `c_wchar` arrays.
- `CFUNCTYPE` types as `argtypes`, `restype` and structure/union fields (read
  back as callables); `sizeof` / `alignment` of `CFUNCTYPE` and `alignment` of
  `POINTER` types.
- `POINTER(POINTER(T))` and `POINTER(CFUNCTYPE)` element access
  (`pp[i].contents`, `pp[i] = pointer(x)`).
- `prototype([name, library])` and `prototype([name, library], paramflags)`,
  as Python's `prototype((name, dll), paramflags)`; `paramflags` also accept
  Python tuples `[flag, name, default]`.
- A structure instance as the single positional initializer
  (`new RECT(point)`).
- `memmove` / `memset` accept addresses, ctypes instances and pointers, not
  only Buffers.
- `c_void_p` parameters accept strings (passed as `char *`) and any
  TypedArray, DataView or ArrayBuffer.
- Objects assigned to pointer / `CFUNCTYPE` fields and array elements are
  kept alive with the structure, as Python's `_objects`.
- `POINTER(T)` arguments of callbacks are pointer objects; objects returned by
  callbacks are converted like arguments.
- `readValue` / `writeValue` accept pointer objects.
- `wintypes` matches Python's `ctypes.wintypes` on all its names: structures
  (`RECT`, `POINT`, `SIZE`, `MSG`, `FILETIME`, `SMALL_RECT`, `_COORD`,
  `WIN32_FIND_DATAA/W`), pointer types (`LPRECT`, `PHANDLE`, `LPMSG`, ...),
  `RGB()`, `MAX_PATH`, `VARIANT_BOOL` and the missing handle types.
- TypeScript: `wintypes` declarations; `static _fields_ = [["x", c_int]]`
  compiles without `as const`; `_pack_` as a number; typed `contents`,
  callable array types, buffer `.value` / `.raw`, pointer and function-pointer
  results; `StructureOf`, `ArrayInstance`, `CharBufferValue`,
  `WideBufferValue`, `MemoryTarget`.
- Type tests in `tests/types` (`npm run test:types`) and Python parity tests
  (`tests/common/test_python_parity.js` with its Python twin).

### Fixed

- Segmentation fault when passing a JS function or a plain object to a
  pointer parameter (e.g. a function to `qsort` instead of a callback).
- Segmentation fault when assigning a union instance with a pointer member
  (e.g. `c_wchar_p`) to a structure field.
- Segmentation fault when passing pointers created with `fromAddress()` and
  callback wrappers as arguments.
- `addressof()` of an array instance threw a "requires a Buffer" error.
- `wstring_at(addr)` truncated strings at 256 characters (512 on Windows), and
  so did long `c_wchar_p` fields; `wstring_at(addr, n)` behaved differently on
  Windows and Unix; invalid code points threw `RangeError` (now U+FFFD).
- `string_at(buffer)` could read past the end of the Buffer.
- `c_long` / `c_ulong` fields threw when assigned a BigInt on Windows, and so
  did 32-bit bit fields.
- `wchar_t` alignment in arrays and structures (`alignof(wchar_t)`).
- The function cache could return a function declared with other types of the
  same name (now keyed by type identity).
- `pointer(structInstance).contents` was not an instance of the structure
  class; `.constructor` of structure instances returned a bound function.
- `restype = null` (Python's `None`) threw `Invalid return type`; it now
  means `void`.
- The native module was looked up from `process.cwd()`: applications started
  from another directory, and nested installs, failed with "Native module not
  found". It is now located from the package itself (the previous locations
  remain as a fallback).
- macOS prebuilt binaries required the macOS version of the CI runner
  (26.0 on arm64, 15.0 on x64); they now target macOS 13.5, like Node 24.

### Performance

- Faster calls: per-function `call` without wrapper unwrapping, direct-call
  invokers for common signatures and lighter argument marshalling. In
  `tests/benchmarks/benchmark_koffi.js` the average gap with koffi dropped
  from 2.56x to about 1.45x (Apple Silicon).
- Faster JS paths: `readValue` at an address, array element access,
  `create_string_buffer`, structure instances sharing one Proxy handler.

### Changed

- Native code uses node-addon-api only; raw N-API is confined to
  `src/napi_fast.h` and all system headers are included from `src/shared.h`.
- `typescript` is a devDependency; CI type-checks `lib/index.d.ts` in a
  dedicated job and packaging depends on it.
- Linux binaries are built in `manylinux_2_28` containers: they require glibc
  2.28 (like Node 24) and the system libstdc++, instead of glibc 2.34 and the
  libstdc++ of GCC 13 (Ubuntu 22.04 and Debian 11/12 could not load them).
  CI fails if a build raises these requirements.
- Examples rewritten in Python ctypes style (`wintypes` structures,
  `DWORD()` / `HKEY()` with `byref` and `.value`, `in_dll`, `buf.value`,
  typed prototypes instead of raw Buffers and offsets).

## [1.14.0] - 2026-10-21

### Changed

- libffi updated to 3.8.0 (through 3.7.0 and 3.7.1), with `ffi_call_plan`
  support.
- Dependencies updated to their latest versions.

### Added

- Benchmark of node-ctypes against `node:ffi`.

## [1.13.0] - 2026-06-22

### Added

- `Symbol.dispose` support for callbacks and libraries (`using`).

### Changed

- `node:` prefix for built-in imports; koffi updated to 3.x in benchmarks.

## [1.12.0] - 2026-04-24

### Changed

- Library restructured for Python ctypes parity and maintainability.

### Performance

- No array allocations in the slow path of `func()` call wrappers; branch
  hints on the FFI hot path.

## [1.11.1] - 2026-04-22

### Fixed

- LDAP example: binary attributes preserved when `ensureSchema` inherits the
  caller options.

## [1.11.0] - 2026-04-22

### Changed

- `GetLastError` / `errno` API unified with Python ctypes semantics.

## [1.10.1] - 2026-04-22

### Performance

- Lower per-call overhead in the hot path.

### Fixed

- Documentation of the lazy library loaders.

## [1.10.0] - 2026-04-20

### Added

- Broader Python ctypes parity.

### Changed

- LTO/IPO enabled for Release builds.

## [1.9.0] - 2026-04-18

### Added

- Typed API and callback leak guard.

### Performance

- Faster structures.

### Fixed

- ESM import in tests on Windows (`pathToFileURL`).

## [1.8.0] - 2026-03-14

### Added

- `POINTER()` fields in unions; more tests and Python compatibility.

### Fixed

- Pointer size.

## [1.7.0] - 2026-03-11

### Added

- `PointerTypeDef` and `alignment()`; better pointer handling in structures
  and unions.

## [1.6.0] - 2026-03-09

### Added

- Documentation and examples.

### Fixed

- SID interpretation (`objectsid`) in the LDAP example.

## [1.5.0] - 2026-02-20

### Added

- Function pointer type factories (`CFUNCTYPE` / `WINFUNCTYPE`), callbacks
  with optional ABI.
- COM automation example (`IShellLinkW`, `IPersistFile`) and LDAP wrapper
  example (`wldap32.dll`).

## [1.4.0] - 2026-02-10

### Added

- Asynchronous function calls; simpler variadic calls.

### Changed

- Better error messages.

## [1.3.0] - 2026-02-05

### Added

- Inline string buffers and pointer support; cross-platform C library
  loading in tests.

## [1.2.0] - 2026-02-01

### Changed

- CType internals reworked; spdlog and dotenv removed.

## [1.1.0] - 2026-01-28

### Added

- PC/SC smart card example.

### Changed

- `long` / `ulong` alignment handling; values returned as BigInt.

## [1.0.2] - 2026-01-24

### Fixed

- `wchar` and pointer handling in primitive types.

## [1.0.1] - 2026-01-24

### Fixed

- Buffer handling in primitive type writers.

## [1.0.0] - 2026-01-24

### Changed

- Security and cross-platform improvements; JS files restructured.

## 0.1.x - 2026-01-17 to 2026-01-23

Initial releases.

[Unreleased]: https://github.com/dmazzella/node-ctypes/compare/v2.17.1...HEAD
[2.17.1]: https://github.com/dmazzella/node-ctypes/compare/v2.17.0...v2.17.1
[2.17.0]: https://github.com/dmazzella/node-ctypes/compare/v2.16.4...v2.17.0
[2.16.4]: https://github.com/dmazzella/node-ctypes/compare/v2.16.3...v2.16.4
[2.16.3]: https://github.com/dmazzella/node-ctypes/compare/v2.16.2...v2.16.3
[2.16.2]: https://github.com/dmazzella/node-ctypes/compare/v2.16.1...v2.16.2
[2.16.1]: https://github.com/dmazzella/node-ctypes/compare/v2.16.0...v2.16.1
[2.16.0]: https://github.com/dmazzella/node-ctypes/compare/v2.15.5...v2.16.0
[2.15.5]: https://github.com/dmazzella/node-ctypes/compare/v2.15.4...v2.15.5
[2.15.4]: https://github.com/dmazzella/node-ctypes/compare/v2.15.3...v2.15.4
[2.15.3]: https://github.com/dmazzella/node-ctypes/compare/v2.15.2...v2.15.3
[2.15.2]: https://github.com/dmazzella/node-ctypes/compare/v2.15.1...v2.15.2
[2.15.1]: https://github.com/dmazzella/node-ctypes/compare/v2.15.0...v2.15.1
[2.15.0]: https://github.com/dmazzella/node-ctypes/compare/v2.14.0...v2.15.0
[2.14.0]: https://github.com/dmazzella/node-ctypes/compare/v2.13.2...v2.14.0
[2.13.2]: https://github.com/dmazzella/node-ctypes/compare/v2.13.1...v2.13.2
[2.13.1]: https://github.com/dmazzella/node-ctypes/compare/v2.13.0...v2.13.1
[2.13.0]: https://github.com/dmazzella/node-ctypes/compare/v2.12.2...v2.13.0
[2.12.2]: https://github.com/dmazzella/node-ctypes/compare/v2.12.1...v2.12.2
[2.12.1]: https://github.com/dmazzella/node-ctypes/compare/v2.12.0...v2.12.1
[2.12.0]: https://github.com/dmazzella/node-ctypes/compare/v2.11.1...v2.12.0
[2.11.1]: https://github.com/dmazzella/node-ctypes/compare/v2.11.0...v2.11.1
[2.11.0]: https://github.com/dmazzella/node-ctypes/compare/v2.10.0...v2.11.0
[2.10.0]: https://github.com/dmazzella/node-ctypes/compare/v2.9.0...v2.10.0
[2.9.0]: https://github.com/dmazzella/node-ctypes/compare/v2.8.0...v2.9.0
[2.8.0]: https://github.com/dmazzella/node-ctypes/compare/v2.7.0...v2.8.0
[2.7.0]: https://github.com/dmazzella/node-ctypes/compare/v2.6.0...v2.7.0
[2.6.0]: https://github.com/dmazzella/node-ctypes/compare/v2.5.0...v2.6.0
[2.5.0]: https://github.com/dmazzella/node-ctypes/compare/v2.4.0...v2.5.0
[2.4.0]: https://github.com/dmazzella/node-ctypes/compare/v2.3.0...v2.4.0
[2.3.0]: https://github.com/dmazzella/node-ctypes/compare/v2.2.0...v2.3.0
[2.2.0]: https://github.com/dmazzella/node-ctypes/compare/v2.1.1...v2.2.0
[2.1.1]: https://github.com/dmazzella/node-ctypes/compare/v2.1.0...v2.1.1
[2.1.0]: https://github.com/dmazzella/node-ctypes/compare/v2.0.0...v2.1.0
[2.0.0]: https://github.com/dmazzella/node-ctypes/compare/v1.14.0...v2.0.0
[1.14.0]: https://github.com/dmazzella/node-ctypes/compare/v1.13.0...v1.14.0
[1.13.0]: https://github.com/dmazzella/node-ctypes/compare/v1.12.1...v1.13.0
[1.12.0]: https://github.com/dmazzella/node-ctypes/compare/v1.11.1...v1.12.1
[1.11.1]: https://github.com/dmazzella/node-ctypes/compare/v1.11.0...v1.11.1
[1.11.0]: https://github.com/dmazzella/node-ctypes/compare/v1.10.1...v1.11.0
[1.10.1]: https://github.com/dmazzella/node-ctypes/compare/v1.10.0...v1.10.1
[1.10.0]: https://github.com/dmazzella/node-ctypes/compare/v1.9.0...v1.10.0
[1.9.0]: https://github.com/dmazzella/node-ctypes/compare/v1.8.0...v1.9.0
[1.8.0]: https://github.com/dmazzella/node-ctypes/compare/v1.7.0...v1.8.0
[1.7.0]: https://github.com/dmazzella/node-ctypes/compare/v1.6.0...v1.7.0
[1.6.0]: https://github.com/dmazzella/node-ctypes/compare/v1.5.0...v1.6.0
[1.5.0]: https://github.com/dmazzella/node-ctypes/compare/v1.4.0...v1.5.0
[1.4.0]: https://github.com/dmazzella/node-ctypes/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/dmazzella/node-ctypes/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/dmazzella/node-ctypes/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/dmazzella/node-ctypes/compare/v1.0.2...v1.1.0
[1.0.2]: https://github.com/dmazzella/node-ctypes/compare/dbbb592...v1.0.2
[1.0.1]: https://github.com/dmazzella/node-ctypes/compare/78acf28...dbbb592
[1.0.0]: https://github.com/dmazzella/node-ctypes/compare/v0.1.7...78acf28
