From: "Iñaki Baz Castillo" Date: 2012-05-10T21:05:00+09:00 Subject: Re: How to use Data_Wrap_Struct to assign the DATA VALUE to an exsiting Ruby object? 2012/5/10 Iñaki Baz Castillo : > So I think that using DATA_PTR(self) is not what I expected. IMHO it > completely replaces the current C data of the Ruby object, while the > only I want is to "attach" a C structure to a given Ruby object. Am I > right? If I use klass.new instead of klass.allocate, then it does not crash. However I cannot use the Data in other methods of the klass: struct my_udp_cdata *cdata = DATA_PTR(self); this returns ugly data, it's not the data I previously stored using: DATA_PTR(self) = cdata; Probably it makes no sense what I'm doing. -- Iñaki Baz Castillo