Exemple #1
0
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))
}
Exemple #2
0
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)
}