MrSaints / go-node-ffi

[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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Download, and install the package:

    go get github.com/mrsaints/go-node-ffi
  2. 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).

About

[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.

License:MIT License


Languages

Language:C 50.9%Language:JavaScript 39.0%Language:Go 10.1%