>>>>> "M" == Martin Chase <stillflame / go.com> writes:

M> --------------------------
M>   Dictionary LP_dict;
M>   int cost;

M>   Data_Get_Struct(self, Dictionary, &LP_dict);
M>   cost = dictionary_get_max_cost(LP_dict);
M>   return INT2NUM(cost);
M> --------------------------

 Just write it like this

     Dictionary LP_dict;
     int cost;

     Data_Get_Struct(self, struct Dictionary_s, LP_dict);
     cost = dictionary_get_max_cost(LP_dict);
     return INT2NUM(cost);

 and it will probably work.

 Because you have probably somewhere in your source

     typedef struct Dictionary_s *Dictionary;

 and the code is equivalent to

     struct Dictionary_s *LP_dict;
     int cost;

     Data_Get_Struct(self, struct Dictionary_s, LP_dict);
     cost = dictionary_get_max_cost(LP_dict);
     return INT2NUM(cost);


M> -----------(from the program)-----------
M> dict = (Dictionary) xalloc(sizeof(struct Dictionary_s));
M> ----------------------------------------

 Dictionary is a pointer, Data_Wrap_Struct want a pointer this is why you
 just need to write

   Dictionary LP_dict = dictionary_create(/* ... */);
   argv[0] = rb_dict = Data_Wrap_Struct(class, 0, LP_dict_delete, LP_dict); 
   rb_obj_call_init(rb_dict, 1, argv); 
   return rb_dict; 



Guy Decoux