Skip to content

Commit f8dcb39

Browse files
committed
initial commit
0 parents  commit f8dcb39

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

01_bare_minimum/modulename.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <node/v8.h>
2+
#include <node/node.h>
3+
4+
void RegisterModule(v8::Handle<v8::Object> target) {
5+
// You can add properties to the module in this function. It is called
6+
// when the module is required by node.
7+
}
8+
9+
// Register the module with node. Note that "modulename" must be the same as
10+
// the basename of the resulting .node file. You can specify that name in
11+
// wscript. When you change it there, change it here too.
12+
NODE_MODULE(modulename, RegisterModule);

01_bare_minimum/wscript

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
3+
def set_options(ctx):
4+
ctx.tool_options('compiler_cxx')
5+
6+
def configure(ctx):
7+
ctx.check_tool('compiler_cxx')
8+
ctx.check_tool('node_addon')
9+
10+
def build(ctx):
11+
t = ctx.new_task_gen('cxx', 'shlib', 'node_addon')
12+
13+
# All source files to compile
14+
t.source = ['modulename.cc']
15+
16+
# The name of the build result (the part before .node). If you change this,
17+
# make sure you also change the name specified in the "NODE_MODULE"
18+
# registration in modulename.cc
19+
t.target = 'modulename'

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# How to write node.js modules using C++
2+
3+
This is a tutorial for writing [node.js](http://nodejs.org/) modules in C++. It is the base and reference for my talk on writing node.js modules with V8 at [JSConf 2011 in Berlin](http://jsconf.eu/2011).

0 commit comments

Comments
 (0)