Project

General

Profile

Actions

Bug #7514

closed

DL::Function and DL::Importer#bind_function ignores abi and name when Fiddle is available

Added by ngoto (Naohisa Goto) almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Target version:
ruby -v:
-
Backport:
[ruby-core:50562]

Description

Like Bug #7484, when Fiddle is available, Fiddle's DL wrapper for DL::Function ignores :stdcall ABI. In addition, when creating callback closure, DL::Function wrapped by Fiddle does not set name, and DL::Function#name raises NoMethodError.

Actions #1

Updated by ngoto (Naohisa Goto) almost 12 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r38202.
Naohisa, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/dl/lib/dl/func.rb (DL::Function#initialize, DL::Function#bind):
    ABI should be set by using CFunc#calltype even when Fiddle is used.
    When Fiddle is used and a block is given, name shoud not be ignored.
    [ruby-core:50562] [Bug #7514]
  • ext/dl/lib/dl/import.rb (DL::Importer#bind_function): should respect
    abi and name when Fiddle is used.
  • test/dl/test_func.rb (test_name_with_block): test for "name" method
    with giving a block.

Updated by usa (Usaku NAKAMURA) almost 12 years ago

  • Category set to ext
  • Status changed from Closed to Assigned
  • Assignee set to ngoto (Naohisa Goto)
  • Target version set to 2.0.0

Hmm, when using DL::Function, the patch solves the problem.

But, when we try to shift to Fiddle from DL, since Fiddle::Function
does not still have name.
So we can not shift simply.
I think that better solution of this problem is not deceiving DL::Function,
but adding name to Fiddle::Function perfectly.

Goto-san, Aaron, how do you think about this?

In addition, I am actually afflicted by this shift problem now, and this
problem is serious for me.

Updated by ngoto (Naohisa Goto) almost 12 years ago

In the commit r38243, Fiddle::Function#name is added, and Fiddle::Importer#import_function and bind_function set the name. The name attribute would be used by Fiddle version of Win32::Registry.

Updated by ngoto (Naohisa Goto) almost 12 years ago

  • Status changed from Assigned to Closed

In r38322, Fiddle::Function#initialize can get name by using :name keyword argument. For example,
Fiddle::Function.new(ptr, [], Fiddle::TYPE_VOID, name: "example")

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0