Here is my sample code:-

In ruby file-\

require 'test'
talloc = Myalloc::MyClass.new("New");
talloc.defin(1000000)  // Creates an array of size 1000000
talloc.alloc('3d',31)  // Allocates the String '3d' at index 31
myA=talloc.use(31)  // Fetch the string from index 31 and store in myA

The 'use' function in C is coded as:--

VALUE use(VALUE self,VALUE pos)
{
   int arr_pos = NUM2INT(pos);
   printf("Index Contains:%s\n",array[arr_pos]); // array is a char **
   return NUM2CHR(array[arr_pos]);

}

But when i run the above ruby code it is giving me an error which I
can't figure out what it means and whats wrong going on.

The error is:--

test.rb:5:in `use': method `respond_to?' called on terminated object
(0x63da10) (NotImplementedError)
        from test.rb:5


Can anyone explain to me this error and how to get rid of it?

Thanks
Tridib

-- 
Posted via http://www.ruby-forum.com/.