Hello ruby miners, I have a following problem when I trying to do a very simple C extension. When I'm trying to access my methods ruby says that method is undefined. I.e. > ruby -r foo.so -e "foo = Foo.new('bar'); foo.foo" -e:1: undefined method `foo' for Foo:Class (NameError) I don't understand this because >ruby -r foo.so -e "foo = Foo.new('bar'); p foo.instance_methods;" ["foo"] seems to tell good things. I have probably understood something wrong? Here is relevant code: --- foo.c #include <ruby.h> VALUE cFoo; VALUE foo_new(VALUE self, VALUE bar) { rb_iv_set(self, "@foo", bar); return (self); } VALUE foo_foo(VALUE self) { return rb_iv_get(self, "@foo"); } void Init_foo() { cFoo = rb_define_class("Foo", rb_cObject); rb_define_singleton_method(cFoo, "new", foo_new, 1); rb_define_method(cFoo, "foo", foo_foo, 0); } --- foo.c --- extconf.rb require "mkmf" $CFLAGS += "-I../../include/ -I../include -I.. -I. -Wall" create_makefile("foo") --- extconf.rb