From: Ryan Davis Date: 2012-04-05T06:02:27+09:00 Subject: Re: Terminated Object Error. Help Needed On Apr 4, 2012, at 13:16 , Tridib Bandopadhyay wrote: > 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) The last line uses `array[arr_pos]` but you aren't setting array in your function. You should probably be using something accessed via self.