On Apr 4, 2012, at 13:16 , Tridib Bandopadhyay wrote:

> Here is my sample code:-
>=20
> In ruby file-\
>=20
> require 'test'
> talloc =3D 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=3Dtalloc.use(31)  // Fetch the string from index 31 and store in =
myA
>=20
> The 'use' function in C is coded as:--
>=20
> VALUE use(VALUE self,VALUE pos)
> {
>   int arr_pos =3D NUM2INT(pos);
>   printf("Index Contains:%s\n",array[arr_pos]); // array is a char **
>   return NUM2CHR(array[arr_pos]);
>=20
> }
>=20
> 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.
>=20
> The error is:--
>=20
> 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.