Wed Feb 01 11:27:36 2012: Request 74578 was acted upon. Transaction: Correspondence added by DOUGW Queue: Win32-API Subject: Win32::API::Struct not aligned on 64 bit Broken in: 0.64 Severity: Normal Owner: Nobody Requestors: do...@cpan.org Status: open Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=74578 >
On Wed Feb 01 02:15:26 2012, COSIMO wrote: > Hi Doug, thanks for filing this. > > What do to about it? > Not sure, other than CC'ing libwin32@perl.org as you did. Cool, I didn't know RT cc'd the mailing list (maybe someone else will know what to do). What I've done is hack Struct.pm getPack() and getUnpack(): in getPack(): $type_align = (($packed_size + $type_size) % $type_size); # $packing .= "x" x $type_align . $type; $packing .= $type; $packed_size += $type_size; # $packed_size += $type_size + $type_align; } in getUnpack(): $type_align = (($packed_size + $type_size) % $type_size); # $packing .= "x" x $type_align . $type; $packing .= $type; # $packed_size += $type_size + $type_align; $packed_size += $type_size; push(@items, $name); } Perhaps if this change were wrapped in is_64bit() type logic, then it would work everywhere? I don't know enough about this to really know for sure, and I'm not even sure if I haven't broken something else. And if this change is headed in the right direction, there should probably be some changes to the align() and sizeof() methods.