sigar/go_bindings/gotoc/utils.go

29 lines
329 B
Go
Raw Normal View History

2016-01-04 18:23:11 +08:00
package gotoc
import (
"unsafe"
)
/*
#include <stdlib.h>
*/
2016-01-04 18:23:11 +08:00
import "C"
const (
SIGAR_OK = 0
)
2016-01-04 18:23:11 +08:00
func SigarStringToGoString(cstring *C.char) string{
var theString string = C.GoString(cstring)
defer C.free(unsafe.Pointer(cstring))
return theString
}
func Free(cstring *C.char) {
C.free(unsafe.Pointer(cstring))
}