From: Mark Volkmann Date: 2007-03-11T14:11:20+09:00 Subject: creating Ruby objects from C 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? ID class_id = rb_intern("String"); VALUE stringClass = rb_const_get(rb_cClass, class_id); // wrong 1st parameter? ID method_id = rb_intern("new"); VALUE s1 = rb_funcall(stringClass, method_id, 1, "test"); printf("s1 = %s!\n", RSTRING(s1)->ptr);