in reply to Re: Need to pass an unsigned char array from an xsub back to Perl
in thread Need to pass an unsigned char array from an xsub back to Perl

Thank you so much for the quick reply. Indeed, your solution is very elegant. I am a newbie in xsubb. I did use the second method.
PREINIT: unsigned char uuid_arr[16]; CODE: char convert_arr[33]; int i; XGenerateSessionID((uuid_t*) &uuid_arr); memset(convert_arr,'\0',33); for(i=0; i< 16; i++){ snprintf(&convert_arr[i*2], sizeof(convert_arr)-(i*2), "%02X" +, uuid_arr[i]); } RETVAL = newSVpvn(convert_arr,33); OUTPUT: RETVAL
If I had not converted the unsigned char back to char, the compiler complains of signedness.
  • Comment on Re^2: Need to pass an unsigned char array from an xsub back to Perl
  • Download Code