add c_export

This commit is contained in:
2020-01-30 21:03:38 +08:00
parent 9b6409e134
commit ce78aa2a93
6 changed files with 82 additions and 0 deletions

8
c_export/call_in_node.js Normal file
View File

@@ -0,0 +1,8 @@
var ffi = require('ffi');
var stringtools = ffi.Library('target/debug/libstringtools.dylib', {
'count_substrings': ['int', ['string', 'string']]
});
console.log(stringtools.count_substrings("banana", "na"));