Last active
August 29, 2015 14:08
-
-
Save wware/8a0d0fcd98dbbc921898 to your computer and use it in GitHub Desktop.
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
{ | |
"targets": [ | |
{ | |
"target_name": "foo", | |
"sources": [ "foo.cxx", "foo_wrap.cxx" ] | |
} | |
] | |
} |
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
int sum(int x, int y) | |
{ | |
return x + y; | |
} |
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
int sum(int x, int y); |
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
%module foo | |
%{ | |
#include "foo.h" | |
%} | |
%include "foo.h" |
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
#!/bin/sh | |
if [ ! -f ./build/Release/foo.node ] | |
then | |
swig -c++ -javascript -node foo.i | |
node-gyp clean || exit 1 | |
node-gyp configure || exit 1 | |
node-gyp build || exit 1 | |
fi | |
node tryit.js |
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 foo = require('./build/Release/foo'); | |
console.log(foo.sum(3, 4)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment