Example #1
0
File: v7.go Project: botvs/go-v7
func (v *V7) Exec(js string) (interface{}, error) {
	_js := C.CString(js)
	defer C.free(unsafe.Pointer(_js))

	var result C.v7_val_t
	C.v7_exec(v.ctx.rctx, _js, &result)

	return toValue(v.ctx, result)
}
Example #2
0
File: gov7.go Project: edvakf/gov7
func (v7 *V7) Exec(code string) (Val, error) {
	var result C.v7_val_t

	cs := C.CString(code)
	defer C.free(unsafe.Pointer(cs))

	e := C.v7_exec((*C.struct_v7)(v7), &result, cs)

	v := Val(result)

	// DEBUG
	//fmt.Println(v7.ToJSON(v, 2048))

	return v, v7.convertError(v, e)
}