Created
March 22, 2011 21:59
-
-
Save niklasfi/882176 to your computer and use it in GitHub Desktop.
hello.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var import = require('./build/default/hello.node') | |
console.log('import.hello: ' + import.hello) | |
//logs: "import.hello: world" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <v8.h> | |
using namespace v8; | |
extern "C" void | |
init (Handle<Object> target) | |
{ | |
HandleScope scope; | |
target->Set(String::New("hello"), String::New("world")); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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