in reply to Accessing a multi-dimensional hash within an XS routine

because
HV* h2 = (HV*)*h2r;
*h2r is not a hash (HV *), its a reference. You need to use SvRV to dereference it, for example:
HV *h2 = (HV *) SvRV(*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).

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
    Perfect! Thanks.
Re^2: Accessing a multi-dimensional hash within an XS routine
by ikegami (Patriarch) on Apr 04, 2016 at 20:18 UTC
    Tip: MUTABLE_HV(...) is safer than (HV*)...