github.com/moontrade/unsafe@v0.9.1/cgo/internal/trampoline/trampoline.go (about) 1 package trampoline 2 3 /* 4 #cgo CXXFLAGS: -std=c++11 -I./ 5 #cgo LDFLAGS: -lstdc++ 6 #include "trampoline.h" 7 */ 8 import "C" 9 import "unsafe" 10 11 var ( 12 Stub = C.moontrade_stub 13 Sleep = C.moontrade_sleep // moontrade_sleep(u64 nanoseconds) 14 ) 15 16 func CGO() { 17 C.moontrade_stub() 18 } 19 20 func NonBlocking(fn *byte, arg0, arg1 uintptr) { 21 Blocking(fn, arg0, arg1) 22 } 23 24 func Blocking(fn *byte, arg0, arg1 uintptr) { 25 C.moontrade_trampoline((C.size_t)(uintptr(unsafe.Pointer(fn))), (C.size_t)(arg0), (C.size_t)(arg1)) 26 }