diff options
author | Determinant <tederminant@gmail.com> | 2019-06-14 17:49:28 -0400 |
---|---|---|
committer | Determinant <tederminant@gmail.com> | 2019-06-14 17:49:28 -0400 |
commit | cb133a379998112600ea1504b556484a417cf48a (patch) | |
tree | bbdc377f6e49f593ff42d5755ddd95c9f288f5f3 /salticidae.go | |
parent | 6e9c400985c3e553509d926f1d31094fbd344c8f (diff) |
update the library; fix bugs
Diffstat (limited to 'salticidae.go')
-rw-r--r-- | salticidae.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/salticidae.go b/salticidae.go index dba50c0..0698f39 100644 --- a/salticidae.go +++ b/salticidae.go @@ -3,8 +3,20 @@ package salticidae // #cgo CFLAGS: -I${SRCDIR}/salticidae/include/ // #cgo LDFLAGS: ${SRCDIR}/salticidae/libsalticidae.so -Wl,-rpath=${SRCDIR}/salticidae/ +// #include "salticidae/util.h" import "C" import "unsafe" type rawptr_t = unsafe.Pointer type Opcode = uint8 +type Error = C.struct_SalticidaeCError + +func (self *Error) GetCode() int { return int((*C.struct_SalticidaeCError)(self).code) } + +func NewError() Error { + return C.struct_SalticidaeCError {} +} + +func StrError(code int) string { + return C.GoString(C.salticidae_strerror(C.int(code))) +} |