Skip to content

Instantly share code, notes, and snippets.

@niklasfi
Created March 22, 2011 21:59
Show Gist options
  • Save niklasfi/882176 to your computer and use it in GitHub Desktop.
Save niklasfi/882176 to your computer and use it in GitHub Desktop.
hello.cc
var import = require('./build/default/hello.node')
console.log('import.hello: ' + import.hello)
//logs: "import.hello: world"
#include <v8.h>
using namespace v8;
extern "C" void
init (Handle<Object> target)
{
HandleScope scope;
target->Set(String::New("hello"), String::New("world"));
}
root@vs1145146:/var/www/node-addon# node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
'configure' finished successfully (0.032s)
Waf: Entering directory `/var/www/node-addon/build'
Waf: Leaving directory `/var/www/node-addon/build'
'build' finished successfully (0.005s)
srcdir = '.'
blddir = 'build'
VERSION = '0.0.1'
def set_options(opt):
opt.tool_options('compiler_cxx')
def configure(conf):
conf.check_tool('compiler_cxx')
conf.check_tool('node_addon')
def build(bld):
obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
obj.target = 'hello'
obj.source = 'hello.cc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment