Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Inline::C : passing parameters to functions, modifying by reference

by bliako (Monsignor)
on Jul 23, 2021 at 11:13 UTC ( #11135342=note: print w/replies, xml ) Need Help??


in reply to Re: Inline::C : passing parameters to functions, modifying by reference
in thread Inline::C : passing parameters to functions, modifying by reference

syphilis, I was expecting your call. Thanks.

You saw that correctly. And the culprit, as per advice from LeoNerd at https://kiwiirc.com/nextclient/#irc://irc.perl.org/#perl (23/07/2021 @ 10:50 server time) is in the filling part: av_push(av, (SV *)av2); should become av_push(av, newRV_noinc((SV *)av2)); . And sv_setsv() should be sv_setrv()

Which is non-existent but LeoNerd posted this:

/************************************************************/ /* Monkeypath by LeoNerd to set an arrayref into a scalarref As posted on https://kiwiirc.com/nextclient/#irc://irc.perl.org/#pe +rl at 10:50 23/07/2021 A BIG THANK YOU LeoNerd */ #define HAVE_PERL_VERSION(R, V, S) \ (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > ( +V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S)))))) #define sv_setrv(s, r) S_sv_setrv(aTHX_ s, r) static void S_sv_setrv(pTHX_ SV *sv, SV *rv) { sv_setiv(sv, (IV)rv); #if !HAVE_PERL_VERSION(5, 24, 0) SvIOK_off(sv); #endif SvROK_on(sv); } /************************************************************/

I am posting the full working script as a comment to my question.

bw, bliako

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135342]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (None)
    As of 2021-10-18 02:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My first memorable Perl project was:







      Results (72 votes). Check out past polls.

      Notices?