gopher-lua icon indicating copy to clipboard operation
gopher-lua copied to clipboard

Binding to shared object (running a C function)

Open LevitatingBusinessMan opened this issue 4 years ago • 1 comments
trafficstars

Is it possible to run C functions? Like how in Lua or LuaJit you have the ffi library?

LevitatingBusinessMan avatar Feb 22 '21 00:02 LevitatingBusinessMan

See https://github.com/yuin/gopher-lua/issues/256 You can only run pure Lua Code. Lua Modules which load C libraries do not work.

If you want to use C functions with gopher-lua you have to write a wrapper in Go around the C library and then expose that wrapper to lua. I'm not aware of any Go FFI library for usage with gopher-lua

Simerax avatar Mar 10 '21 15:03 Simerax