On Mar 10, 2007, at 9:11 PM, Mark Volkmann wrote: > The following snippet of C code shows my attempt to create a Ruby > string object by invoking the "new" method on the Ruby String > class. I know it would be easier to do this using the rb_str_new or > rb_str_new2 functions. However, I'm trying to understand how to > create arbitrary Ruby objects from C using the "new" method. Can > you spot what's wrong with this code? require 'rubygems' require 'inline' class X def initialize puts "blah" end end class Y inline do |builder| builder.c ' VALUE blah() { return rb_funcall(rb_path2class("X"), rb_intern("new"), 0); }' end end p Y.new.blah # % ./blah.rb # blah # #<X:0x1090ec4>