* [ruby-dev:50959] [Ruby master Bug#12987] Win32 API.rb can not call function without argument.
[not found] <redmine.issue-12987.20161128112442.1004@ruby-lang.org>
@ 2020-09-11 20:32 ` merch-redmine
0 siblings, 0 replies; only message in thread
From: merch-redmine @ 2020-09-11 20:32 UTC (permalink / raw)
To: ruby-dev
Issue #12987 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Open to Closed
I tried with `ruby 2.6.3p62 (2019-04-16 revision 67580) [i386-mingw32]` and `ruby 1.9.3p551 (2014-11-13) [i386-mingw32]` and was able to call a function without an argument:
```ruby
require 'Win32API'
getch = Win32API.new("C:\\Windows\\SysWOW64\\crtdll.dll", "_getch", [], 'L')
getch.Call
# => 97
```
So I think this can be closed.
----------------------------------------
Bug #12987: Win32 API.rb can not call function without argument.
https://bugs.ruby-lang.org/issues/12987#change-87539
* Author: katonbo (Masahiro Kitajima)
* Status: Closed
* Priority: Normal
* Backport: 2.1: WONTFIX, 2.2: REQUIRED, 2.3: REQUIRED
----------------------------------------
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]
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-11 20:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-12987.20161128112442.1004@ruby-lang.org>
2020-09-11 20:32 ` [ruby-dev:50959] [Ruby master Bug#12987] Win32 API.rb can not call function without argument merch-redmine
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).