summaryrefslogtreecommitdiff
path: root/doc/api/n-api.md
diff options
context:
space:
mode:
authorGabriel Schulhof <gabriel.schulhof@intel.com>2018-08-24 13:11:50 -0400
committerGabriel Schulhof <gabriel.schulhof@intel.com>2018-09-03 11:32:29 -0400
commit7033fc771a1832d678cbcd7ec48b848f7acc647c (patch)
tree15f784c025133aaf6d78e64b524b2ef4488ba865 /doc/api/n-api.md
parent4f70ecc9edad9c1ce1d46af8a0965cf8aca0bd28 (diff)
downloadandroid-node-v8-7033fc771a1832d678cbcd7ec48b848f7acc647c.tar.gz
android-node-v8-7033fc771a1832d678cbcd7ec48b848f7acc647c.tar.bz2
android-node-v8-7033fc771a1832d678cbcd7ec48b848f7acc647c.zip
doc: add blurb about implications of ABI stability
Mention that ABI stability can be achieved only by linking to ABI- stable parts of Node.js and to other libraries which are ABI-stable. PR-URL: https://github.com/nodejs/node/pull/22508 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'doc/api/n-api.md')
-rw-r--r--doc/api/n-api.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md
index a21d1f7ad7..4f27d8c552 100644
--- a/doc/api/n-api.md
+++ b/doc/api/n-api.md
@@ -42,6 +42,36 @@ for the N-API C based functions exported by Node.js. These wrappers are not
part of N-API, nor will they be maintained as part of Node.js. One such
example is: [node-addon-api](https://github.com/nodejs/node-addon-api).
+## Implications of ABI Stability
+
+Although N-API provides an ABI stability guarantee, other parts of Node.js do
+not, and any external libraries used from the addon may not. In particular,
+none of the following APIs provide an ABI stability guarantee across major
+versions:
+* the Node.js C++ APIs available via any of
+ ```C++
+ #include <node.h>
+ #include <node_buffer.h>
+ #include <node_version.h>
+ #include <node_object_wrap.h>
+ ```
+* the libuv APIs which are also included with Node.js and available via
+ ```C++
+ #include <uv.h>
+ ```
+* the V8 API available via
+ ```C++
+ #include <v8.h>
+ ```
+
+Thus, for an addon to remain ABI-compatible across Node.js major versions, it
+must make use exclusively of N-API by restricting itself to using
+```C
+#include <node_api.h>
+```
+and by checking, for all external libraries that it uses, that the external
+library makes ABI stability guarantees similar to N-API.
+
## Usage
In order to use the N-API functions, include the file