From: Jamis Buck Date: 2004-10-29T03:51:07+09:00 Subject: Re: Dereferencing PtrData in Ruby/DL Carl Youngblood wrote: > Hello. I have allocated a pointer using DL.malloc: > > window = DL.malloc(DL.sizeof('P')) > > At times in my code I have to pass a pointer this pointer, and at > other times I have to pass in the value of the pointer itself. Does > anybody know how to dereference PtrData? > > Thanks, > Carl Youngblood Carl, I believe that if you have a variable 'x' that is a DL::PtrData instance, you can do: y = x.ref #-> get pointer to the pointer x z = y.ptr #-> obtain the value that y points to, as a PtrData assert x == z I only tried this in IRB, but it appears to work as I described it. - Jamis -- Jamis Buck jgb3@email.byu.edu http://www.jamisbuck.org/jamis