2016-01-04 18:23:11 +08:00
|
|
|
package gotoc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
2016-01-04 18:30:16 +08:00
|
|
|
/*
|
|
|
|
#include <stdlib.h>
|
|
|
|
*/
|
2016-01-04 18:23:11 +08:00
|
|
|
import "C"
|
|
|
|
|
2016-01-04 18:30:16 +08:00
|
|
|
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
|
|
|
|
|
2016-01-04 18:30:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func Free(cstring *C.char) {
|
|
|
|
C.free(unsafe.Pointer(cstring))
|
|
|
|
}
|
|
|
|
|