Skip to content

Instantly share code, notes, and snippets.

@lupomontero
Last active October 2, 2015 12:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lupomontero/2245562 to your computer and use it in GitHub Desktop.
Save lupomontero/2245562 to your computer and use it in GitHub Desktop.
#include <node.h>
namespace cpphello {
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::String;
using v8::Value;
void Foo(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
args.GetReturnValue().Set(String::NewFromUtf8(isolate, "Hello World"));
}
void Init(Local<Object> exports) {
NODE_SET_METHOD(exports, "foo", Foo);
}
NODE_MODULE(cpphello, Init)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment