Building native Node.js addons in Reason
summary
Shows how to build a real Node.js native addon from Reason/OCaml: initialize with npm, run camlnode + dune build to produce a .node shared object, and register via Node’s N-API rather than raw V8 or NAN. Demonstrates converting values (value_to_float/value_to_string), composing signature codecs to validate args, creating functions exported to JS, and attaching OCaml data with extensible externals. Live demo mostly works but notes added N-API safety tradeoffs: persistent refs hurt perf and leaks are possible.
AI-written summary · about
chapters (11)
- 0:00Start
- 3:29Access to the Platform
- 5:34V8 Api
- 11:20The Build System
- 12:11Demo
- 17:09Abstract Types
- 21:44Create a Javascript Function
- 26:14Signature Wrap
- 34:07Ply Function
- 35:49String Codec
- 43:13Constructor
related talks
31mBuilding Modern Native Add-ons for Node.js in 2021
25mIntroduction to native extensions
21mModern C++ Addons for Node.js
55mNode.js N-API for Rust
29mRust Native Module with Node-API
30mCreating Node Addons, C/C++ extensions for fun and profit
24mThe Mad Science of Node
39mNext Generation N-API: A Hands-on Workshop
