DoCGoCall is the function wrapper to call a cgo function, check whether there is any exception thrown by the function and converted it to a golang error if any.
(f func() (uintptr, unsafe.Pointer))
| 24 | // DoCGoCall is the function wrapper to call a cgo function, check whether there is any exception thrown by the function |
| 25 | // and converted it to a golang error if any. |
| 26 | func DoCGoCall(f func() (uintptr, unsafe.Pointer)) uintptr { |
| 27 | res, pStrErr := f() |
| 28 | if pStrErr != nil { |
| 29 | errMsg := C.GoString((*C.char)(pStrErr)) |
| 30 | C.free(pStrErr) |
| 31 | panic(utils.StackError(nil, errMsg)) |
| 32 | } |
| 33 | return res |
| 34 | } |
no test coverage detected