There is a C function which returns some string to a provided pointer:
void snmp_error(netsnmp_session *sess, int *clib_errorno,
int *snmp_errorno, char **errstring);
The Perl6 version is:
sub snmp_error(Snmp-session, int32 is rw, int32 is rw, Str is rw) is native("netsnmp") { * };
snmp_error($sess, my int32 $errno, my int32 $liberr, my Str $errstr);
say $errno, " ", $liberr, " ", $errstr;
It returns correct ints but not a string:
0 -3 (Str)
Is it a just a bug or something is wrong here?
perl6 -v
This is Rakudo version 2016.12 built on MoarVM version 2016.12
implementing Perl 6.c.
The same is on
This is Rakudo version 2017.09 built on MoarVM version 2017.09.1
implementing Perl 6.c.
When I wrestled with the same problem I translated this:
into this:
which works for me.