Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.
/ go-node-ffi Public archive

[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

Notifications You must be signed in to change notification settings

MrSaints/go-node-ffi

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Packages