in reply to Accessing a multi-dimensional hash within an XS routine
*h2r is not a hash (HV *), its a reference. You need to use SvRV to dereference it, for example:HV* h2 = (HV*)*h2r;
Also, it's a good idea to check whether key1 was found (h2r != NULL) and if its a reference (SvROK(*h2r)) to a hash (SvTYPE(SvRV(*h2r)) == SVtPVHV).HV *h2 = (HV *) SvRV(*h2r);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Accessing a multi-dimensional hash within an XS routine
by bh (Initiate) on Apr 03, 2016 at 21:59 UTC | |
|
Re^2: Accessing a multi-dimensional hash within an XS routine
by ikegami (Patriarch) on Apr 04, 2016 at 20:18 UTC |