Skip to content
New issue

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

how to use GoInterface struct in CGO? #19

Open
idevz opened this issue Feb 25, 2020 · 1 comment
Open

how to use GoInterface struct in CGO? #19

idevz opened this issue Feb 25, 2020 · 1 comment

Comments

@idevz
Copy link

idevz commented Feb 25, 2020

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?

@andreapicaro
Copy link

Hello @idevz, we are looking to do the same, did you eventually find a way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants