<p>
When using Win32::API::Struct on 64bit, I get extraneous "x" (null
bytes) in the pack/unpack templates.
When I do a straight unpack without the x's, I get the data correctly.
</p>
<p>
Or if I remove the 'align' logic in Win32::API::Struct::getPack() and
getUnpack(), I also get a correct result.
Is this a bug or is there something else I should be doing?
</p>
<pre>
$Win32::API::DEBUG = 1;
Win32::API::Struct->typedef('DLXSTRUCT', qw(
CHAR VarName[12];
LONG32 StartDate;
LONG32 EndDate;
INT32 NumberObs;
INT32 Frequency;
ULONG32 DateTimeMod;
INT32 Magnitude;
INT32 DecPrecision;
INT32 DifType;
INT32 AggType;
CHAR DataType[8];
CHAR Group[4];
CHAR Source[6];
CHAR Geography1[8];
CHAR Geography2[8];
CHAR Descriptor[82];
CHAR ShortSource[10];
CHAR LongSource[70];
)) or die "Err";
# 'PPS' when using the Struct above
# 'PPP' when using the buffer below
my $GetInfo = Win32::API->new(
# $dll, 'DLXGetInfo', 'PPP', 'I',
$dll, 'DLXGetInfo', 'PPS', 'I',
) or die "Err: $!";
# When using 'PPP' above
#my $dlx = " " x 246;
# Character fields missing first 3 characters, number fields are garbage
my $info_result = $get_info->Call('', $field, $dlx);
# Debug output:
# (PM)Struct::getPack: DLXSTRUCT(buffer) =
pack(a12xlxxliiLiiiia8a4a6a8a8a82a10a71, 48)
# (PM)Struct::getUnpack(DLXSTRUCT):
unpack(Z12xlxxliiLiiiiZ8Z4Z6Z8Z8Z82Z10Z71, ...field names)
# For 'PPP' call above
# Everything ok
#my ($name, $start, $end, $n_obs, $freq, $dt_mod, $mag, $prec,
# $diftype, $agg_type, $data_type, $group, $source, $geo1, $geo2,
$desc, $short_source, $long_source)
# = unpack('Z12 l l i i L i i i i Z8 Z4 Z6 Z8 Z8 Z82 Z10 Z70', $dlx);
</pre>