in reply to Re: Win32::API::Struct problem
in thread Win32::API::Struct problem

Size of this struct is reported as 3!?
Win32::API::Struct->typedef('test', qw( long array[10]; char i; char z; ));
Size of this is reported as 40 (logical, since one "long" = 4bytes * 10 = 40).
Win32::API::Struct->typedef('test', qw( long array[10]; ));
What is this all about?

Replies are listed 'Best First'.
Re^3: Win32::API::Struct problem
by syphilis (Archbishop) on Oct 27, 2006 at 07:38 UTC
    What is this all about?

    Looks like a bug - this one looks like it might be related to http://rt.cpan.org/Public/Bug/Display.html?id=6757 which refers you to http://www.perlmonks.org/index.pl?node_id=369601. As mentioned in the update to that perlmonks post, there seems to be some problem with the member alignment aspect of the computation - which becomes apparent when you turn on $Win32::API::DEBUG (as recommended in an earlier post). You can handle structs in Win32::API without having to resort to using Win32::API::Struct. I think that not using Win32::API::Struct is probably the best way to workaround any problems that Win32::API::Struct throws at you :-)

    Cheers,
    Rob