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
Thats quite bloated. This is less bloated.void GenerateSessionID() PREINIT: char uuid[16]; PPCODE: XSessionID((uuid_t*)uuid); ST(0) = newSVpvn(uuid, 16); sv_2mortal(ST(0)); XSRETURN(1);
Also the OP might want to zero his UUID since we are not checking the return value of XSessionID to determine failure.void GenerateSessionID() PREINIT: char uuid[16] = {0); //zero fill PPCODE: XSessionID((uuid_t*)uuid); PUSHs(sv_2mortal((newSVpvn(uuid, 16)));
|
|---|