Skip to content

No bool type #130

Closed
Closed

Description

@eregon
/home/eregon/.rubies/ruby-3.2.2/lib/ruby/3.2.0/fiddle/cparser.rb:247:in `parse_ctype': unknown type: bool (Fiddle::DLError)
	from /home/eregon/.rubies/ruby-3.2.2/lib/ruby/3.2.0/fiddle/cparser.rb:117:in `parse_signature'
	from /home/eregon/.rubies/ruby-3.2.2/lib/ruby/3.2.0/fiddle/import.rb:168:in `extern'

for extern "bool foo(void *buffer)" with extend Fiddle::Importer.

Maybe a workaround is to use typealias, but not sure what would be the correct type then.

Activity

  1. kou commented on Jul 3, 2023

    @kou
    Member

    Good catch.
    I've implemented it.

  2. eregon commented on Jul 30, 2023

    @eregon
    MemberAuthor

    Thanks!
    Ideally extern "bool foo(void *buffer)" would return Ruby true/false, not 1/0 (which are both truthy in Ruby).
    Do you think Fiddle could handle that?

  3. kou commented on Jul 30, 2023

    @kou
    Member

    Ah, then we should not implement bool as an alias.

  4. reopened this on Jul 30, 2023
  5. added a commit that references this issue on Aug 2, 2023
  6. reopened this on Aug 3, 2023
  7. eregon commented on Oct 27, 2023

    @eregon
    MemberAuthor

    @kou Should we revert bc6c66b maybe? Because if bool is then implemented properly to use Ruby true/false instead of 1/0 then it would be incompatible when that changes.

  8. kou commented on Oct 27, 2023

    @kou
    Member

    Is it for Ruby 3.3.0?
    If I can implement bool <-> Ruby's true/false soon, we don't need to revert the commit, right?

  9. kou commented on Oct 27, 2023

    @kou
    Member

    Implemented.

  10. eregon commented on Oct 29, 2023

    @eregon
    MemberAuthor

    Thanks!
    Yeah, I just wanted to avoid the half-done support for boolean to get in a Fiddle release, or if it did for as short as possible.

  11. added 2 commits that reference this issue on Mar 6, 2024
    bc6c66b
    2640e01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions