From: "Matthew S." Date: 2011-12-06T01:45:16+09:00 Subject: Re: Using DATA_PTR in multiple methods Sylvester Keil wrote in post #1035129: > > Is this a C++ extensions? I would be careful mixing new/delete and > Ruby's x-allocators. Why would you do that here? Would it not be better > to use xmalloc and Data_Wrap_Struct? No. I'm attempting this in pure C. The tsk library is written in cpp, if that's relevant. As for Data_Wrap_Struct, I tried that like so: TSK_IMG_INFO * ptr = malloc(sizeof(TSK_IMG_INFO)); Data_Wrap_Struct(klass, NULL, deallocate, ptr); I understood Data_Make_Struct to combine these two steps, so I did. I assumed the product, ptr, is returned when the allocation function ends. Every example I found returned the Data_Wrap_Struct function, so again I thought I was on the right track. I've tried malloc and ALLOC, with no change in my tests. Haven't tried xalloc yet. -- Posted via http://www.ruby-forum.com/.