diff --git a/array.go b/array.go index 60e3a56..bdc02fa 100644 --- a/array.go +++ b/array.go @@ -12,7 +12,7 @@ type Array struct { // Len returns the length of the array. func (v *Array) Len() int { - return int(C.mrb_ary_len(v.state, v.value)) + return int(C._mrb_ary_len(v.value)) } // Get gets an element form the Array by index. diff --git a/func.go b/func.go index 57991ef..dac1aa4 100644 --- a/func.go +++ b/func.go @@ -63,7 +63,7 @@ func goMRBFuncCall(s *C.mrb_state, v C.mrb_value) C.mrb_value { // Lookup the class itself classTable.Mutex.Lock() - methodTable := classTable.Map[ci.proc.target_class] + methodTable := classTable.Map[ci.target_class] classTable.Mutex.Unlock() if methodTable == nil { panic(fmt.Sprintf("func call on unknown class")) diff --git a/gomruby.h b/gomruby.h index 2319a93..3272957 100644 --- a/gomruby.h +++ b/gomruby.h @@ -268,4 +268,8 @@ static inline mrb_value _go_mrb_gv_get(mrb_state *m, mrb_sym sym) { return mrb_gv_get(m, sym); } +static inline mrb_int _mrb_ary_len(mrb_value ary) { + return RARRAY_LEN(ary); +} + #endif diff --git a/value.go b/value.go index dd6af23..7a4d3d7 100644 --- a/value.go +++ b/value.go @@ -139,7 +139,7 @@ func (v *MrbValue) GCProtect() { // when this value is a proc. func (v *MrbValue) SetProcTargetClass(c *Class) { proc := C._go_mrb_proc_ptr(v.value) - proc.target_class = c.class + proc.e = *(*[8]byte)(unsafe.Pointer(&c.class)) } // Type returns the ValueType of the MrbValue. See the constants table.