On Tue, Aug 08, 2006 at 03:01:23PM +0000, Jeremy White wrote: > >I wrote a function which packs the c data structure into a perl object: > > > >SV* > >perl_xmmsclient_new_sv_from_ptr(void* ptr, const char* class) { > > SV* obj; > > SV* sv; > > HV* stash; > > > > obj = (SV*)newHV(); > > sv_magic(obj, 0, PERL_MAGIC_ext, (const char*)ptr, 0); > > sv = newRV_inc(obj); > > stash = gv_stashpv(class, 1); > > sv_bless(sv, stash); > > > > return sv; > >} > > Ok - is there a reason why you are using a HV? If not, then you should use > a SV via a typemap to simplify the whole object creation process - the > typemap would use sv_setref_pv - to create the blessed object in one step.
I use a hash + magic to allow the user to store arbitrary data inside the object. I don't really want to change that to a blessed integer value which stores the address of the c stucture I'd like to wrap. Also I don't see the relation to the actualy problem here. -Flo -- BOFH excuse #170: popper unable to process jumbo kernel
signature.asc
Description: Digital signature