Re: [go-nuts] ask for you help about cgo and interface

2019-12-04 Thread FAN DEAR
a sample code? thank you very much! 在 2019年12月3日星期二 UTC+8下午11:28:47,Ian Lance Taylor写道: > > On Tue, Dec 3, 2019 at 12:29 AM FAN DEAR > > wrote: > > > > typedef struct { void *t; void *v; } GoInterface; > > > > > > What is *t and *v? > > See h

Re: [go-nuts] ask for you help about cgo and interface

2019-12-03 Thread FAN DEAR
typedef struct { void *t; void *v; } GoInterface; What is *t and *v? 在 2019年12月3日星期二 UTC+8上午2:41:36,Ian Lance Taylor写道: > > On Mon, Dec 2, 2019 at 9:57 AM FAN DEAR > > wrote: > > > > > > How to use add2 function, i am very troubled. > > On this maili

[go-nuts] ask for you help about cgo and interface

2019-12-02 Thread FAN DEAR
in my go file: package main import "C" // AddListener ... //export AddListener type AddListener interface { addResult(i int) } func main() { } // Add ... //export Add func Add(i, j int) int { return i + j } // Add2 ... //export Add2 func Add2(i, j int, listener AddListener) { listener.addResu