On Sun, 2 Dec 2001, Michael L Maraist wrote: > On Sunday 02 December 2001 02:47 pm, Brent Dax wrote: > > Quick comment: I've been thinking about constructing an 'OpaqueHandle' > > PMC type. All the programmer is supposed to know about it is that it > > points to Something (usually a C struct, but they don't have to know > > that). I'm not sure what trying to access it results in--perhaps it'll > > look like a reference from the outside ("ParrotInterp=HANDLE(0xDECAF)"), > > or maybe it'll throw a tantrum. > > Perl5 just used a string as the generic c-struct handle as far as I know..
Actually, most XS I've seen uses an SvIV and just stores a pointer using PTR2INT. Then when you need to access pointer you just do an INT2PTR and get it back out. Since Perl5's IV is garaunteed to be large enough for a pointer this all works fine. -sam