adds vendor directory
vendors dependencies in standard `vendor` directory, managed by glide
This commit is contained in:
9
vendor/github.com/mattn/go-pointer/_example/callback.h
generated
vendored
Normal file
9
vendor/github.com/mattn/go-pointer/_example/callback.h
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <unistd.h>
|
||||
|
||||
typedef void (*callback)(void*);
|
||||
|
||||
static void call_later(int delay, callback cb, void* data) {
|
||||
sleep(delay);
|
||||
cb(data);
|
||||
}
|
||||
|
29
vendor/github.com/mattn/go-pointer/_example/main.go
generated
vendored
Normal file
29
vendor/github.com/mattn/go-pointer/_example/main.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user