[rt.cpan.org #94906] Signed return values not working

[email protected] ("[email protected] via RT") Mon, 21 Apr 2014 08:38:47 -0400
Newsgroups perl.libwin32
Message-ID <[email protected]>
Mon Apr 21 08:38:47 2014: Request 94906 was acted upon.
Transaction: Ticket created by [email protected]
       Queue: Win32-API
     Subject: Signed return values not working
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: [email protected]
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=94906 >


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 ([email protected]) - tel. +358 40 7348034