Project

General

Profile

Bug #12987

Win32 API.rb can not call function without argument.

Added by katonbo (Masahiro Kitajima) about 3 years ago. Updated about 3 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-dev:49888]

Description

In Win32API.rb, it is not possible to call a function without arguments.
I could avoid it for the time being if I did the following (against trunk).

diff --git a/ext/win32/lib/Win32API.rb b/ext/win32/lib/Win32API.rb
index d03ecc1..946be3e 100644
--- a/ext/win32/lib/Win32API.rb
+++ b/ext/win32/lib/Win32API.rb
@@ -17,6 +17,7 @@ class Win32API
   def initialize(dllname, func, import, export = "0", calltype = :stdcall)
     @proto = [import].join.tr(WIN32_TYPES, DL_TYPES).sub(/^(.)0*$/, '\1')
     import = @proto.chars.map {|win_type| TYPEMAP[win_type.tr(WIN32_TYPES, DL_T
+    @proto = "" if @proto == "0"
     export = TYPEMAP[export.tr(WIN32_TYPES, DL_TYPES)]
     calltype = Fiddle::Importer.const_get(:CALL_TYPE_TO_ABI)[calltype]

History

Updated by usa (Usaku NAKAMURA) about 3 years ago

For workaround, you can use '' instead of '0'.

Updated by usa (Usaku NAKAMURA) about 3 years ago

  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: WONTFIX, 2.2: REQUIRED, 2.3: REQUIRED

Updated by katonbo (Masahiro Kitajima) about 3 years ago

Thank you very much.
I just learned that only nil was clearly stating that there are no arguments in the previous document.
I used a single 'V' to specify no arguments, so it was up to this idea.

Also available in: Atom PDF