Subject: | Signed return values not working |
Date: | Mon, 21 Apr 2014 15:38:37 +0300 |
To: | <bug-Win32-API [...] rt.cpan.org> |
From: | "Mikko Noromaa" <mikko [...] noromaa.fi> |
Hello!
I am declaring my function as follows:
my $TestFunc = Win32::API->new('PerlWin32.dll', '_TestFunc@24', 'PPPPPP',
'i');
The C code looks as follows:
int WINAPI TestFunc(char *str1, char *str2, char *str3, char *str4, char
*str5, char *str6)
{
...
return (-1);
}
On ActiveState Perl 5.16.3 this worked fine and returned -1 to Perl.
However, on ActiveState Perl 5.18.2 the function returns 4294967295.
I am using Win32::API version 0.77. The same problem occurred with version
0.75 that was pre-installed with ActiveState Perl 5.18.2.
When looking at perl -V, I see ActiveState has added USE_64_BIT_INT after
5.16.3. My guess is this affects the way Win32::API handles the return
values. Since I am specifying 'i' (signed int), Win32::API should return -1
to Perl as -1, not as 4294967295. By the way, even 'I' (unsigned int)
returned -1 on ActiveState Perl 5.16.3.
--
Mikko Noromaa (mikko@noromaa.fi) - tel. +358 40 7348034