[MacRuby-devel] [MacRuby] #691: Runtime should allow pointer types for C-string arguments

MacRuby ruby-noreply at macosforge.org
Thu May 6 16:01:18 PDT 2010


#691: Runtime should allow pointer types for C-string arguments
--------------------------------+-------------------------------------------
 Reporter:  mike@…              |        Owner:  lsansonetti@…        
     Type:  enhancement         |       Status:  closed               
 Priority:  major               |    Milestone:  MacRuby 0.7          
Component:  MacRuby             |   Resolution:  fixed                
 Keywords:                      |  
--------------------------------+-------------------------------------------
Changes (by lsansonetti@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.7


Comment:

 Should be fixed in r4034. I haven't tried this specific OpenGL function
 but the following snippet works:

 {{{
 $ cat t.rb
 framework 'Foundation'
 s = NSString.stringWithString('foo')
 ptr = Pointer.new(:char, 4)
 p s.getCString(ptr, maxLength: 4, encoding: NSASCIIStringEncoding)
 4.times { |i| p ptr[i].chr }

 $ ./miniruby t.rb
 true
 "f"
 "o"
 "o"
 "\x00"
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/691#comment:1>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list