Esempio n. 1
0
File: v7.go Progetto: botvs/go-v7
func _v7_to_json(ctx *C.struct_v7, val C.v7_val_t, size int) []byte {
	buf := make([]byte, size)
	p := C.CString(string(buf))
	defer C.free(unsafe.Pointer(p))
	ret := C.v7_to_json(ctx, val, p, C.size_t(size))
	return []byte(C.GoString(ret))
}
Esempio n. 2
0
File: gov7.go Progetto: edvakf/gov7
func (v7 *V7) ToJSON(v Val, size int) string {
	buflen := C.size_t(size)
	buf := (*C.char)(C.malloc(buflen))
	defer C.free(unsafe.Pointer(buf))

	C.v7_to_json((*C.struct_v7)(v7), C.v7_val_t(v), buf, buflen)
	return C.GoString(buf)
}