From: Ernest Ellingson Date: 2005-05-08T13:15:30+09:00 Subject: Problem with Math module in extension. I'm trying to do something real simple find the sin of an angle in an extension. I'm sure you'll recognize the following code as a variation of the example in Pick Axe 2. I've read README.EXT. Looked at Math.c been all over the web and I can't seem to figure out the correct way to do this. Can someone give me a clue? Ernie #include "ruby.h" static int id_push; static VALUE t_init(VALUE self) { VALUE arr; arr=rb_ary_new(); rb_iv_set(self, "@arr", arr); return self; } static VALUE t_add(VALUE self, VALUE obj) { VALUE arr; VALUE si; arr=rb_iv_get(self, "@arr"); si=sin(obj); rb_funcall(arr, id_push,1,si); return arr; } VALUE cTest; void Init_junk() { cTest=rb_define_class("Junk", rb_cObject); rb_define_method(cTest, "initialize",t_init,0); rb_define_method(cTest, "add", t_add,1); Init_Math(); id_push = rb_intern("push"); } after compiling require 'junk' a=Junk.new a.add(0.75) puts a => false;