Skip to content

Instantly share code, notes, and snippets.

@xealgo
Created June 9, 2013 19:44
Show Gist options
  • Save xealgo/86bab21567dcc6498211 to your computer and use it in GitHub Desktop.
Save xealgo/86bab21567dcc6498211 to your computer and use it in GitHub Desktop.
basic nodejs c++ module
#include <v8.h>
#include <node.h>
using namespace node;
using namespace v8;
static Handle<Value> test_prnt(const Arguments& args)
{
Local<String> s1 = String::New("The cow says: ");
Local<String> s2 = args[0]->ToString();
return String::Concat(s1, s2);
}
extern "C" void init(Handle<Object> target)
{
NODE_SET_METHOD(target, "test_prnt", test_prnt);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment