Skip to content

Instantly share code, notes, and snippets.

@XadillaX
Created November 27, 2014 08:54
Show Gist options
  • Save XadillaX/dcf9f74ef03948b47c79 to your computer and use it in GitHub Desktop.
Save XadillaX/dcf9f74ef03948b47c79 to your computer and use it in GitHub Desktop.
Node.js C++ addon skeleton.
#include <node.h>
#include <v8.h>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstring>
using namespace std;
Handle<Value> ExportFunction(const Arguments& args)
{
HandleScope scope;
return scope.Close(Undefined());
}
void CreateExports(Handle<Object> exports)
{
exports->Set(String::NewSymbol("exportFunction"),
FunctionTemplate::New(ExportFunction)->GetFunction());
}
NODE_MODULE({{MODULE_NAME}}, CreateExports);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment