Skip Menu |

This queue is for tickets about the Win32-API CPAN distribution.

Report information
The Basics
Id: 36186
Status: rejected
Priority: 0/
Queue: Win32-API

People
Owner: cosimo [...] cpan.org
Requestors: sisyphus [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.55
Fixed in: (no value)



Subject: Win32_API-0.55 can't handle doubles
This is using Win32-API-0.55, Visual Studio 7.0, and perl 5.10.0 (built from source using the same Visual Studio 7.0 compiler) --- mydll.h ---- __declspec(dllexport) int my_int(int); __declspec(dllexport) double my_double(int); ---------------- --- mydll.c ---- #include "mydll.h" __declspec(dllexport) int my_int(int x) { return x / 7; } __declspec(dllexport) double my_double(int x) { return (double) x / 7; } ---------------- Build the dll: ---------------- C:\_32\c>cl /LD mydll.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.00.9466 for 80x86 Copyright (C) Microsoft Corporation 1984-2001. All rights reserved. mydll.c Microsoft (R) Incremental Linker Version 7.00.9466 Copyright (C) Microsoft Corporation. All rights reserved. /out:mydll.dll /dll /implib:mydll.lib mydll.obj Creating library mydll.lib and object mydll.exp C:\_32\c> ---------------- The perl script that attempts to access mydll.dll using Win32-API-0.55: --- mydll.pl --- use Win32::API; use warnings; $func1 = new Win32::API('mydll', 'my_int', 'N', 'N', '_cdecl'); $val = $func1->Call(123); print "Val1: $val\n"; $func2 = new Win32::API('mydll', 'my_double', 'N', 'D', '_cdecl'); $val = $func2->Call(123); print "Val2: $val\n"; ---------------- Run mydll.pl: ---------------- C:\_32\c>perl mydll.pl Val1: 17 Use of uninitialized value $val in concatenation (.) or string at mydll.pl line 12. Val2: C:\_32\c> ---------------- Clearly the reported value for $val1 is correct, but not for $val2. Cheers, Rob
On Mon May 26 07:53:40 2008, SISYPHUS wrote: Show quoted text
> This is using Win32-API-0.55, Visual Studio 7.0, and perl 5.10.0
(built Show quoted text
> from source using the same Visual Studio 7.0 compiler) > > --- mydll.h ---- > --- mydll.c ----
Show quoted text
> Cheers, > Rob
Great! Thank you very much. This is likely to speed up things a bit :)
From: bulk88(1) [...] hotmail.com
On Mon May 26 07:53:40 2008, SISYPHUS wrote: Show quoted text
> This is using Win32-API-0.55, Visual Studio 7.0, and perl 5.10.0 (built > from source using the same Visual Studio 7.0 compiler) > > --- mydll.h ---- > __declspec(dllexport) int my_int(int); > > __declspec(dllexport) double my_double(int); > > ---------------- > > --- mydll.c ---- > #include "mydll.h" > > __declspec(dllexport) int my_int(int x) { > return x / 7; > } > > __declspec(dllexport) double my_double(int x) { > return (double) x / 7; > } > > ---------------- > > Build the dll: > > ---------------- > C:\_32\c>cl /LD mydll.c > Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.00.9466 for > 80x86 > Copyright (C) Microsoft Corporation 1984-2001. All rights reserved. > > mydll.c > Microsoft (R) Incremental Linker Version 7.00.9466 > Copyright (C) Microsoft Corporation. All rights reserved. > > /out:mydll.dll > /dll > /implib:mydll.lib > mydll.obj > Creating library mydll.lib and object mydll.exp > > C:\_32\c> > ---------------- > > The perl script that attempts to access mydll.dll using Win32-API-0.55: > > --- mydll.pl --- > use Win32::API; > use warnings; > > $func1 = new Win32::API('mydll', 'my_int', 'N', 'N', '_cdecl'); > $val = $func1->Call(123); > > print "Val1: $val\n"; > > $func2 = new Win32::API('mydll', 'my_double', 'N', 'D', '_cdecl'); > $val = $func2->Call(123); > > print "Val2: $val\n"; > > ---------------- > > Run mydll.pl: > > ---------------- > C:\_32\c>perl mydll.pl > Val1: 17 > Use of uninitialized value $val in concatenation (.) or string at > mydll.pl line 12. > Val2: > > C:\_32\c> > ---------------- > > Clearly the reported value for $val1 is correct, but not for $val2. > > Cheers, > Rob
I can't reproduce this on Win32::API 0.68. I guess its been fixed by now.
On Sun May 20 10:04:43 2012, bulk88. wrote: Show quoted text
> On Mon May 26 07:53:40 2008, SISYPHUS wrote: > I can't reproduce this on Win32::API 0.68. I guess its been fixed by now.
Currently Win32::API has Show quoted text
___________________________________________________ # Sum 2 doubles $function = new Win32::API($test_dll, 'double sum_doubles(double a, double b)'); ok(defined($function), 'API_test.dll sum_doubles function defined'); #diag("$function->{procname} \$^E=",$^E); ok($function->Call(2.5, 3.2) == 5.7, 'function call with double arguments');
____________________________________________________ as a test, which works. So I closing this bug as rejected. If this is still a problem for you reply back.