xiaoyafeng has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks
Is there a way to get PV address like Devel::Peek do?
I found the above PV address from D::P output is 0x55608d8b8e90, but how can I get this address? I tried SvPVX:use Devel::Peek; my $dd = "hello world\n"; Dump $dd; #output: SV = PV(0x55608d816050) at 0x55608d83a0a8 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0x55608d8b8e90 "hello world\n"\0 CUR = 12 LEN = 14 COW_REFCNT = 1
So Is there a way to get pv address as an INT value like Peek does? Do I need to create a struct to save address? TIA. Regards,my $dd = "hello world\n"; printf("the dd string address is %x \n", cc($dd)); use Inline 'C' => <<'CODE'; unsigned int cc(SV* a){ 40 return SvPVX(a); 41 } 42 CODE # just print the dd string address is 8d8b8e90, the upper 4bytes of th +e address was truncated.
I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How get PV address?
by dave_the_m (Monsignor) on Aug 05, 2019 at 09:56 UTC | |
by xiaoyafeng (Deacon) on Aug 05, 2019 at 10:38 UTC | |
by dave_the_m (Monsignor) on Aug 05, 2019 at 14:51 UTC | |
by xiaoyafeng (Deacon) on Aug 06, 2019 at 02:40 UTC | |
by dave_the_m (Monsignor) on Aug 06, 2019 at 07:13 UTC | |
|