Skip to content

how to use GoInterface struct in CGO? #19

@idevz

Description

@idevz

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions