The resultant C code appears to hold the proper type for the passed in $buf now...int libnet_init_packet(p_size, buf) size_t p_size u_char & buf CODE: u_char * buf_temp; buf_temp = &buf; RETVAL = libnet_init_packet(p_size, &buf_temp); OUTPUT: RETVAL buf int libnet_destroy_packet(buf) u_char & buf CODE: u_char * buf_temp; buf_temp = &buf; RETVAL = libnet_destroy_packet(&buf_temp); OUTPUT: RETVAL buf sv_setsv(ST(0),&PL_sv_undef);
So now, the type for buf passed in is u_char just like the other calls. I just noticed some other value vs. pointer to value mistakes I've made (It seems * and & are not quite as similar as I thought). That aside, I still think the error I am getting does not make sense.XS(XS_Net__LibnetRaw_libnet_init_packet) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Net::LibnetRaw::libnet_init_packet(p_ +size, buf)"); { size_t p_size = (size_t)SvIV(ST(0)); u_char buf = (u_char)SvUV(ST(1)); int RETVAL; dXSTARG; #line 39 "LibnetRaw.xs" u_char * buf_temp; buf_temp = &buf; RETVAL = libnet_init_packet(p_size, &buf_temp); #line 106 "LibnetRaw.c" sv_setuv(ST(1), (UV)buf); SvSETMAGIC(ST(1)); XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); } XS(XS_Net__LibnetRaw_libnet_destroy_packet) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Net::LibnetRaw::libnet_destroy_packet +(buf)"); { u_char buf = (u_char)SvUV(ST(0)); int RETVAL; dXSTARG; #line 50 "LibnetRaw.xs" u_char * buf_temp; buf_temp = &buf; RETVAL = libnet_destroy_packet(&buf_temp); #line 127 "LibnetRaw.c" sv_setsv(ST(0),&PL_sv_undef); SvSETMAGIC(ST(0)); XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); }
In reply to Re: (tye)Re4: XS question: typemap for a pointer to a pointer?
by Big Willy
in thread XS question: typemap for a pointer to a pointer?
by Big Willy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |