File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -367,6 +367,10 @@ set of APIs that are used by the native code. Instead of using the V8
367367or [ Native Abstractions for Node.js] [ ] APIs, the functions available
368368in the N-API are used.
369369
370+ Creating and maintaining an addon that benefits from the ABI stability
371+ provided by N-API carries with it certain
372+ [ implementation considerations] ( n-api.html#n_api_implications_of_abi_stability ) .
373+
370374To use N-API in the above "Hello world" example, replace the content of
371375` hello.cc ` with the following. All other instructions remain the same.
372376
Original file line number Diff line number Diff line change @@ -42,6 +42,36 @@ for the N-API C based functions exported by Node.js. These wrappers are not
4242part of N-API, nor will they be maintained as part of Node.js. One such
4343example is: [node-addon-api](https://github.com/nodejs/node-addon-api).
4444
45+ ## Implications of ABI Stability
46+
47+ Although N-API provides an ABI stability guarantee, other parts of Node.js do
48+ not, and any external libraries used from the addon may not. In particular,
49+ none of the following APIs provide an ABI stability guarantee across major
50+ versions:
51+ * the Node.js C++ APIs available via any of
52+ ```C++
53+ #include <node.h>
54+ #include <node_buffer.h>
55+ #include <node_version.h>
56+ #include <node_object_wrap.h>
57+ ```
58+ * the libuv APIs which are also included with Node.js and available via
59+ ```C++
60+ #include <uv.h>
61+ ```
62+ * the V8 API available via
63+ ```C++
64+ #include <v8.h>
65+ ```
66+
67+ Thus, for an addon to remain ABI-compatible across Node.js major versions, it
68+ must make use exclusively of N-API by restricting itself to using
69+ ```C
70+ #include <node_api.h>
71+ ```
72+ and by checking, for all external libraries that it uses, that the external
73+ library makes ABI stability guarantees similar to N-API.
74+
4575## Usage
4676
4777In order to use the N-API functions, include the file
You can’t perform that action at this time.
0 commit comments