From 2ff2df442c4080ffc6fb1db219dac88a926cba14 Mon Sep 17 00:00:00 2001 From: Kenvin Davies Date: Thu, 26 Apr 2018 20:51:35 -0400 Subject: [PATCH] doc: update blurb explaining NODE_ADDON_API Fixes: https://github.com/nodejs/node-addon-api/issues/249 PR-URL: https://github.com/nodejs/node-addon-api/pull/251 Reviewed-By: Michael Dawson --- doc/node-gyp.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/node-gyp.md b/doc/node-gyp.md index 851b317..5d77dfa 100644 --- a/doc/node-gyp.md +++ b/doc/node-gyp.md @@ -58,10 +58,12 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { /** * This code defines the entry-point for the Node addon, it tells Node where to go * once the library has been loaded into active memory. The first argument must -* match the "target" in our *binding.gyp*. The second argument points to the -* function to invoke. +* match the "target" in our *binding.gyp*. Using NODE_GYP_MODULE_NAME ensures +* that the argument will be correct, as long as the module is built with +* node-gyp (which is the usual way of building modules). The second argument +* points to the function to invoke. The function must not be namespaced. */ -NODE_API_MODULE(myModule, Init) +NODE_API_MODULE(NODE_GYP_MODULE_NAME, Init) ``` ## **node-gyp** reference