20 lines
367 B
Go
20 lines
367 B
Go
package tflite
|
|
|
|
import "C"
|
|
import (
|
|
"unsafe"
|
|
|
|
"github.com/mattn/go-pointer"
|
|
)
|
|
|
|
type callbackInfo struct {
|
|
user_data interface{}
|
|
f func(msg string, user_data interface{})
|
|
}
|
|
|
|
//export _go_error_reporter
|
|
func _go_error_reporter(user_data unsafe.Pointer, msg *C.char) {
|
|
cb := pointer.Restore(user_data).(*callbackInfo)
|
|
cb.f(C.GoString(msg), cb.user_data)
|
|
}
|