[Win32utils-devel] Bug in win32-api with void prototypes?

Daniel Berger djberg96 at gmail.com
Thu Sep 27 22:36:15 EDT 2007


Heesob Park wrote:
> Hi,
> 
> 2007/9/26, Berger, Daniel <Daniel.Berger at qwest.com 
> <mailto:Daniel.Berger at qwest.com>>:
> 
>     Hi all,
> 
>     It seems that a void prototype requires an explicit argument in our
>     version of win32/api:
> 
>     C:\>irb
>     irb(main):001:0> require 'win32/api'
>     => true
> 
>     irb(main):002:0> include Win32
>     => Object
> 
>     irb(main):003:0> require 'Win32API'
>     => true
> 
>     # Our version
>     irb(main):004:0> GetLastErrorA = API.new('GetLastError', 'V', 'L',
>     'kernel32')
>     => #<Win32::API:0x2db6314>
> 
>     # Old version
>     irb(main):005:0> GetLastErrorB = Win32API.new ('kernel32',
>     'GetLastError', 'V', 'L')
>     => #<Win32API:0x2db0518>
> 
>     # Ours fails with no arguments
>     irb(main):006:0> GetLastErrorA.call
>     ArgumentError: wrong number of parameters: expected 1, got 0
>            from (irb):6:in `call'
>            from (irb):6
> 
>     # Works with an explicit nil - intentional?
>     irb(main):007:0> GetLastErrorA.call(nil)
>     => 10038
> 
>     # Old version ignores it
>     irb(main):008:0> GetLastErrorB.call
>     => 10038
> 
>     How should we handle this?
> 
>  
> If the api_call function is called with no argument, just set the 
> argument v_args to [nil].

I released 1.0.1 tonight which fixes this issue.

Regards,

Dan


More information about the win32utils-devel mailing list