Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion array.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion func.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
4 changes: 4 additions & 0 deletions gomruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion value.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this isn't going to work, unless 2.0 has reverted some of the structs this will fail; the target_class notion has completely been changed in 1.4.

I need to read the 2.0 source before I can comment further.

}

// Type returns the ValueType of the MrbValue. See the constants table.
Expand Down