Perl Monk, Perl Meditation | |
PerlMonks |
Re^8: Perl XS binding to a struct with an array of chars*by syphilis (Archbishop) |
on Nov 27, 2022 at 05:23 UTC ( [id://11148401]=note: print w/replies, xml ) | Need Help?? |
Nice work !!
I'll draw attention to an oddity I've just noticed, of perhaps little significance. Regarding the struct definition and typedef: The 'int' type is always 4 bytes on Windows, irrespective of architecture. And I think it's generally the same case on Linux. IIRC, on Linux, it's usually the size of the 'long int' that varies with architecture - but 'int' usually stays at 4 bytes. On 64 bit Windows, I'm finding that if char * str[]; is removed from the struct, then struct size is 4 bytes. If char * str[]; is included, then the struct size is 8 bytes. So it seems that "str" is increasing the size of the struct by 4 bytes. But that doesn't seem right to me. Here's the demo I used:
On 32-bit windows, it seems that char *str[]; does indeed make zero contribution to the size of the struct, and the same script outputs: Cheers, Rob
In Section
Seekers of Perl Wisdom
|
|