This repository has been archived on 2022-06-29. You can view files and clone it, but cannot push or open issues or pull requests.
Jon Chen 737231705f
adds vendor directory
vendors dependencies in standard `vendor` directory, managed by glide
2017-05-14 19:35:03 -07:00

30 lines
398 B
Go

package main
/*
#include "callback.h"
void call_later_go_cb(void*);
*/
import "C"
import (
"fmt"
"unsafe"
"github.com/mattn/go-pointer"
)
type Foo struct {
v int
}
func main() {
f := &Foo{123}
C.call_later(3, C.callback(C.call_later_go_cb), pointer.Save(f))
}
//export call_later_go_cb
func call_later_go_cb(data unsafe.Pointer) {
f := pointer.Restore(data).(*Foo)
fmt.Println(f.v)
}