Call with a raw address to produce a caller.
Call with a JS function to produce a directly callable, typed C callback,
usable as an argument or struct field. Keep it referenced while C may
call it; release() frees it.
Bind an exported function of a library, optionally with paramflags.
Python: prototype((name, dll)) / prototype((name, dll), paramflags).
Shared metadata; assigning it does not recompile the captured signature.
Shared metadata; mutating it does not recompile the captured signature.
Readonly_Bind the factory to a library export with Python-style paramflags.
Out params are allocated automatically and returned alone (one value or
an array). Returning the original args from errcheck keeps this behavior.
callAsync() uses the same output processing and per-call hook snapshot.
Python ctypes parity: prototype((name, lib), paramflags).
const proto = WINFUNCTYPE(DWORD, HWND, LPDWORD);
const fn = proto.bind(user32, "GetWindowThreadProcessId", [
{ dir: "in", name: "hWnd" },
{ dir: "out", name: "pid" },
]);
const pid = fn(hwnd); // positional; thread ID is discarded
const pid2 = fn({ hWnd: hwnd }); // named
const pid3 = await fn.callAsync(hwnd); // async, same output processing
Factory returned by CFUNCTYPE / WINFUNCTYPE.