Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Fix build with MRuby 2.0.0 #73

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion array.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mruby

// #include "gomruby.h"
// mrb_int _mrb_ary_len(mrb_value ary) { return RARRAY_LEN(ary); }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please put this definition in gomruby.h instead of here.

Copy link
Author

Choose a reason for hiding this comment

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

Yep, I thought about this one after I went to bed.

import "C"

// Array represents an MrbValue that is a Array in Ruby.
Expand All @@ -12,7 +13,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
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