We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var FFI = require('ffi-napi'); var Ref = require("ref-napi"); var Struct = require("ref-struct-napi") const hwSharedLibPath = "./go-node-ffi"; /* * GoString ABI-compliant struct * See https://github.com/golang/go/wiki/cgo#go-strings-and-c-strings */ const goString = Struct({ p: "string", n: "long", }); class GoString extends goString { // GoString (cgo) -> JavaScript string static get(buffer, offset) { const _gs = goString.get(buffer, offset); return _gs.p.slice(0, _gs.n); } // JavaScript string -> GoString (cgo) static set(buffer, offset, value) { const _gs = new goString({ p: value, n: value.length, }); return goString.set(buffer, offset, _gs); } } const hw = FFI.Library(hwSharedLibPath, { HelloWorld: [GoString, []], Greet: [GoString, [GoString]], Add: ["int", ["int", "int"]], }); const helloWorld = hw.HelloWorld(); console.log(helloWorld); const addition = hw.Add(2, 4); console.log(addition); const greeting = hw.Greet("John"); console.log(greeting);
I've tried with a few other examples and I get the same error on them all.
I am trying to call a Go .so file and I am getting this error.
The text was updated successfully, but these errors were encountered:
Any updates on this issue?
Sorry, something went wrong.
i have getting same issue
only libs built with golang 1.14 and not newer are working
No branches or pull requests
I've tried with a few other examples and I get the same error on them all.
I am trying to call a Go .so file and I am getting this error.
The text was updated successfully, but these errors were encountered: