[MacRuby-devel] [MacRuby] #401: Cannot call from ObjC to Ruby with an int argument

MacRuby ruby-noreply at macosforge.org
Sat Oct 24 03:53:29 PDT 2009


#401: Cannot call from ObjC to Ruby with an int argument
-------------------------------------+--------------------------------------
 Reporter:  antony.blakey@…          |       Owner:  lsansonetti@…        
     Type:  defect                   |      Status:  new                  
 Priority:  critical                 |   Milestone:  MacRuby 0.5          
Component:  MacRuby                  |    Keywords:                       
-------------------------------------+--------------------------------------
 0.5b1 / 10.6.1

 Given this Obj-C trampoline (with corresponding header):

 {{{
 @implementation CallInDriver
 +(id) test:(id)rubyObject {
   return [rubyObject callWithInt:1];
 }
 @end
 }}}


 and this Ruby that uses it:


 {{{
 class Test
   def callWithInt(i)
     nil
   end
 end
 CallInDriver.test(Test.new)
 }}}


 you get:

 {{{
 Program received signal:  “EXC_BAD_ACCESS".
 }}}

 Changing the ObjC call to:

 {{{
 return [rubyObject callWithInt:[NSNumber numberWithInt: 1]];
 }}}

 doesn't have the problem (as you would expect). I presume this is meant to
 work?

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/401>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list