The C# Dev Kit team replaced C++ Node.js addons (built with node-gyp and requiring Python) with C# using .NET Native AOT. The post walks through building a Node.js native addon in C# using N-API, covering the project setup, module entry point with [UnmanagedCallersOnly], P/Invoke via [LibraryImport] with a custom DLL resolver
Table of contents
How Node.js addons work Copy linkThe project file Copy linkThe module entry point Copy linkCalling N-API from .NET Copy linkMarshalling strings Copy linkImplementing an exported function Copy linkCalling our function from TypeScript Copy linkWhat about existing libraries? Copy linkWhat we gained Copy linkA footnote Copy linkSummary Copy link3 Comments
Sort: