go-node-ffi
go-node-ffi copied to clipboard
[INACTIVE] An experiment using Go 1.5 buildmode to compile shared C libraries, and to subsequently access them through NodeJS bindings via node-ffi. Compatible with Go 1.9, and Node 7.
go-node-ffi
An experiment using Go 1.5 buildmode to compile shared C libraries, and to subsequently access them through NodeJS bindings via node-ffi.
Simply put, let's try calling Go functions from JavaScript.
Tested with go1.9.1
, and Node v7.8.0
.
Installation
-
Download, and install the package:
go get github.com/mrsaints/go-node-ffi
-
Install NPM dependencies:
yarn // OR... npm install
Building
yarn build
// OR...
go build -buildmode=c-shared -o go-node-ffi.so
Running
Tinker with the sample file go-node-ffi.js
, and run:
yarn start
// OR...
node go-node-ffi.js
Debugging
Enable verbose logging:
export DEBUG="ref,ref:struct"
Now, run the program (see above).