Skip to content

Instantly share code, notes, and snippets.

@hisasann
Created February 15, 2017 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hisasann/41211539ddfb7bbcb6928d77f7ed40a8 to your computer and use it in GitHub Desktop.
Save hisasann/41211539ddfb7bbcb6928d77f7ed40a8 to your computer and use it in GitHub Desktop.
node native addon using only node gyp
#include <node.h>
#include <v8.h>
void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
v8::HandleScope scope(isolate);
args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world"));
}
void init(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(exports, "hello", Method);
}
NODE_MODULE(binding, init);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment