syphilis has asked for the wisdom of the Perl Monks concerning the following question:
Within XS code, how do I establish that the TEMP flag is there ? I had thought that SvTEMP(sv) would return the numeric value of the TEMP flag, but it returns zero. I also checked SvTEMP(SvRV(sv)) - which returned 0 (as I expected).SV = RV(0xa88ae8) at 0xa88adc REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0xa889bc SV = PVMG(0x253aedc) at 0xa889bc REFCNT = 1 FLAGS = (OBJECT,IOK,READONLY,OVERLOAD,pIOK) IV = 41565372 NV = 0 PV = 0 STASH = 0x97dea4 "Math::MPFR"
where mpc_realref() is an mpc library function that returns a pointer to an mpfr library structure (mpfr_t).SV * Rmpc_realref(mpc_t *op) { mpfr_t * mpfr_t_obj; SV * obj_ref, * obj; New(42, mpfr_t_obj, 1, mpfr_t); if(mpfr_t_obj == NULL) croak("Failed to allocate memory in Rmpc_r +ealref function"); obj_ref = newSV(0); obj = newSVrv(obj_ref, "Math::MPFR"); mpfr_t_obj = mpc_realref(*op); sv_setiv(obj, INT2PTR(IV,mpfr_t_obj)); SvREADONLY_on(obj); return obj_ref; }
Hence my interest in being able to detect the presence of the TEMP flag.void DESTROY(mpfr_t * op) { if(the TEMP flag is present) {do one thing} else {do the other thing} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: [XS] How to detect the TEMP flag
by BrowserUk (Patriarch) on Nov 20, 2008 at 06:39 UTC | |
by syphilis (Archbishop) on Nov 20, 2008 at 12:23 UTC | |
|
Re: [XS] How to detect the TEMP flag
by syphilis (Archbishop) on Nov 20, 2008 at 05:52 UTC | |
by ikegami (Patriarch) on Nov 20, 2008 at 07:36 UTC | |
by syphilis (Archbishop) on Nov 20, 2008 at 09:43 UTC | |
by ikegami (Patriarch) on Nov 20, 2008 at 10:16 UTC | |
by syphilis (Archbishop) on Nov 20, 2008 at 22:53 UTC | |
|
Re: [XS] How to detect the TEMP flag
by jand (Friar) on Nov 20, 2008 at 19:42 UTC |