Skip to content

Commit 341dbd2

Browse files
author
Gabriel Schulhof
committed
doc: update blurb explaining NODE_ADDON_API
Fixes: #249 PR-URL: #251 Reviewed-By: Michael Dawson <[email protected]>
1 parent cf6c93e commit 341dbd2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

doc/node-gyp.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) {
5858
/**
5959
* This code defines the entry-point for the Node addon, it tells Node where to go
6060
* once the library has been loaded into active memory. The first argument must
61-
* match the "target" in our *binding.gyp*. The second argument points to the
62-
* function to invoke.
61+
* match the "target" in our *binding.gyp*. Using NODE_GYP_MODULE_NAME ensures
62+
* that the argument will be correct, as long as the module is built with
63+
* node-gyp (which is the usual way of building modules). The second argument
64+
* points to the function to invoke. The function must not be namespaced.
6365
*/
64-
NODE_API_MODULE(myModule, Init)
66+
NODE_API_MODULE(NODE_GYP_MODULE_NAME, Init)
6567
```
6668

6769
## **node-gyp** reference

0 commit comments

Comments
 (0)