Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No bool type #130

Closed
eregon opened this issue Jul 2, 2023 · 7 comments
Closed

No bool type #130

eregon opened this issue Jul 2, 2023 · 7 comments

Comments

@eregon
Copy link
Member

eregon commented Jul 2, 2023

/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.

@kou kou closed this as completed in bc6c66b Jul 3, 2023
@kou
Copy link
Member

kou commented Jul 3, 2023

Good catch.
I've implemented it.

@eregon
Copy link
Member Author

eregon commented Jul 30, 2023

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?

@kou
Copy link
Member

kou commented Jul 30, 2023

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

@kou kou reopened this Jul 30, 2023
@kou kou reopened this Aug 3, 2023
@eregon
Copy link
Member Author

eregon commented Oct 27, 2023

@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.

@kou
Copy link
Member

kou commented Oct 27, 2023

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?

@kou kou closed this as completed in 2640e01 Oct 27, 2023
@kou
Copy link
Member

kou commented Oct 27, 2023

Implemented.

@eregon
Copy link
Member Author

eregon commented Oct 29, 2023

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.

matzbot pushed a commit to ruby/ruby that referenced this issue Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants