-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.cc
More file actions
39 lines (30 loc) · 753 Bytes
/
Copy pathmodule.cc
File metadata and controls
39 lines (30 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* module.cc - module for node.js
*
* Purpose:
* Creating erlang nodes to allow node.js script 'talk' to erlang application
*
* Author: Sergey Chernov <chernser@gmail.com>
*/
#define BUILDING_NODE_EXTENSION
#include <iostream>
/* Nodejs includes */
#include <v8.h>
#include <node.h>
#include <node_version.h>
#include "erlnode.h"
using namespace v8;
/**
* createNode - creates erlang node
*/
Handle<Value> createNode(const Arguments& args) {
HandleScope scope;
return scope.Close(ErlNode::NewInstance(args));
}
void init(Handle<Object> target) {
ErlNode::Init();
// Add functions to root object
target->Set(String::NewSymbol("createNode"),
FunctionTemplate::New(createNode)->GetFunction());
}
NODE_MODULE(erlnode, init)