Last active
June 13, 2018 08:59
-
-
Save a7ul/5393b3bda00634aa09c9277c5573cf12 to your computer and use it in GitHub Desktop.
blog-on-node-addon-third
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/binding.gyp b/binding.gyp | |
index 23b9976..2d188af 100644 | |
--- a/binding.gyp | |
+++ b/binding.gyp | |
@@ -4,7 +4,8 @@ | |
"cflags!": [ "-fno-exceptions" ], | |
"cflags_cc!": [ "-fno-exceptions" ], | |
"sources": [ | |
- "cppsrc/main.cpp" | |
+ "cppsrc/main.cpp", | |
+ "cppsrc/Samples/functionexample.cpp" | |
], | |
'include_dirs': [ | |
"<!@(node -p \"require('node-addon-api').include\")" | |
diff --git a/cppsrc/main.cpp b/cppsrc/main.cpp | |
index f016c4e..f62ed77 100644 | |
--- a/cppsrc/main.cpp | |
+++ b/cppsrc/main.cpp | |
@@ -1,7 +1,8 @@ | |
#include <napi.h> | |
+#include "Samples/functionexample.h" | |
Napi::Object InitAll(Napi::Env env, Napi::Object exports) { | |
- return exports; | |
+ return functionexample::Init(env, exports); | |
} | |
NODE_API_MODULE(testaddon, InitAll) | |
diff --git a/index.js b/index.js | |
index 65f955e..e91b98f 100644 | |
--- a/index.js | |
+++ b/index.js | |
@@ -1,3 +1,4 @@ | |
const testAddon = require('./build/Release/testaddon.node'); | |
console.log('addon',testAddon); | |
+console.log(testAddon.hello()); | |
module.exports = testAddon; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment