go-cshared-examples
go-cshared-examples copied to clipboard
how to use `GoInterface` struct in CGO?
like the code below:
t.go
//export testFunc
func testFunc() (a interface{}) {
a = 100
return
}
t.h
typedef struct { void *t; void *v; } GoInterface;
// ...
extern GoInterface testFunc();
we export a function through CGO like extern GoInterface testFunc();
, how to call this from C or Lua or others? how to initialization and using a GoInterface
in C, or in the Luajit FFI context?
Hello @idevz, we are looking to do the same, did you eventually find a way?