From: Bryan Richardson Date: 2008-05-05T12:13:49+09:00 Subject: Need more help with Ruby and C Hello all, So I have something like the following in my C file: static VALUE rb_cBar; static VALUE foo_new() { VALUE new_foo; ... return new_foo; } static VALUE execute(VALUE foos) { VALUE foo = rb_ary_entry(foos, 0); printf("Foo Value: %i\n", rb_iv_get(foo, "@value"); } void Init_bar() { rb_cBar = rb_define_class("Bar", rb_cObject); rb_define_method(rb_cBar, "new_foo", foo_new, 0); rb_define_method(rb_cBar, "execute", execute, 1); } and in my Ruby file I do the following: require 'bar' b = Bar.new a = Array.new a << b.new_foo b.execute(a) My question is with the execute method. It outputs 0.00 when it should output 1.01 (there's a foo_init method called that I didn't include here that sets the value variable of the foo struct to 1.01). I assume this doesn't work because I'm passing the execute method an array created in Ruby code and not an array created using the C functions. Is there some way I can do it the way I'm trying to above? -- Thanks! Bryan -- Posted via http://www.ruby-forum.com/.