You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simplified the instructions of building native modules by dividing
into LTS and non-LTS releases.
Updated link and filename to `win_delay_load_hook.cc` and fixednwjs#5396
Copy file name to clipboardExpand all lines: docs/For Users/Advanced/Use Native Node Modules.md
+11-8Lines changed: 11 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -3,16 +3,19 @@
3
3
4
4
[TOC]
5
5
6
-
`npm` tool provided by Node.js builds the native modules, i.e. [C/C++ Addons](https://nodejs.org/api/addons.html), at the time of installation.
6
+
## For LTS Releases
7
7
8
-
In 0.14.x LTS release, native modules built by node-gyp or npm in upstream can be supported.
8
+
If you are using LTS release, native modules installed by `npm`can be supported after hacking as below:
9
9
10
-
In Linux and OSX you can just load the native module directly. In windows you'll need to replace the file
11
-
%APPDATA%\npm\node_modules\node-gyp\src\win_delay_load_hook.c with the one at https://github.com/nwjs/nw.js/blob/nw13/tools/win_delay_load_hook.c
10
+
* On Linux and Mac, no hacking is required.
11
+
* On Windows, you need to replace the file
12
+
`<npm-path>\node_modules\node-gyp\src\win_delay_load_hook.cc` with the one at https://github.com/nwjs/nw.js/blob/nw18/tools/win_delay_load_hook.cc before installing modules with node-gyp or npm.
12
13
13
-
Before 0.13.0, the V8 version and Node API in NW.js is different from official Node.js. To use native Node.js modules with NW.js, you have to rebuild the modules with one of following tools. Starting from 0.15.0, rebuild with the following tools is also needed due to [ABI change in v8](https://github.com/nwjs/nw.js/issues/5025)
14
+
## For non-LTS Releases
14
15
15
-
## nw-gyp
16
+
If you are using non-LTS release, you have to rebuild the modules with one of following tools due to [ABI differences in V8](https://github.com/nwjs/nw.js/issues/5025).
17
+
18
+
### nw-gyp
16
19
17
20
[`nw-gyp`](https://github.com/nwjs/nw-gyp) is a hack on `node-gyp` to support NW.js specific headers and libraries.
See https://github.com/nwjs/nw-gyp for more details.
28
31
29
-
## node-pre-gyp
32
+
###node-pre-gyp
30
33
31
34
Some packages uses [node-pre-gyp](https://github.com/mapbox/node-pre-gyp), which supports building for both Node.js and NW.js by using either `node-gyp` or `nw-gyp`.
See https://github.com/mapbox/node-pre-gyp for more details.
41
44
42
-
## Known Issues
45
+
###Known Issues
43
46
44
47
So far, you have to rebuild **each native module** with tools above including thoses are indirectly depended modules. Since `binding.gyp` is required for building native modules, you can easily locate all native modules by finding `binding.gyp` file.
0 commit comments