in reply to Inline C : dereferencing array of hash references returned from function
Update: The 'BUILD_NOISY' config option that I've included in the above script ensures that you get the opportunity to see compiler warnings - which can be useful if a script does not behave as intended. It's a good idea to *always* have BUILD_NOISY switched on.use Inline C => Config => BUILD_NOISY => 1; use Inline C; $arref = get_data(); print $arref, "\n"; print $arref->[0]->{mickey}, "\n"; print $arref->[0]->{donkey}, "\n"; __END__ __C__ SV* get_data() { AV * results; HV * rh = newHV(); results = newAV(); hv_store(rh, "mickey", 6, newSVpv("mouse", 0), 0); hv_store(rh, "donkey", 6, newSVpv("kong", 0), 0); av_push(results,newRV_noinc((SV*)rh)); return newRV_noinc((SV*)results); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Inline C : dereferencing array of hash references returned from function
by String62 (Novice) on Feb 16, 2011 at 16:38 UTC | |
|
Re^2: Inline C : dereferencing array of hash references returned from function
by String62 (Novice) on Feb 16, 2011 at 12:24 UTC | |
by ikegami (Patriarch) on Feb 16, 2011 at 14:33 UTC |