Shared publicly  - 
 
I've been doing a little bit of experimentation with GO, I even did proxy that simulates slow connections:
https://github.com/olafura/turtleproxy

Here is my latest piece of experimentation, using channels as a way of getting information back from C. It seems to work, now I just have to experiment more with it.

package main
import "fmt"

/*
extern void go_callback_int(void* icp, int i);

static inline void myprint(void* ic) {
        int j;
        for(j=0; j < 3; j++) {
            go_callback_int(ic, j);
        }
}
*/
import "C"

import "unsafe"

//export go_callback_int
func go_callback_int(icp unsafe.Pointer, i C.int) {
    fmt.Println("gci",i)
    ic := *(*chan int)(icp)
    ic <- (int)(i)
}

func main() {
    ic := make(chan int)
    go C.myprint(unsafe.Pointer(&ic))
    for {
        select {
            case i := <-ic:
                fmt.Println(i)
        }
    }
}

#golang  
1
Add a comment...