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

Define Fiddle.last_error family and Fiddle.dlopen statically #172

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

nobu
Copy link
Member

@nobu nobu commented Jan 31, 2025

RUBY_ENGINE and Fiddle::WINDOWS should not change in a process, no need to be checked inside the methods.

Also, win32_last_error and win32_last_socket_error are equal to last_error on JRuby.

`RUBY_ENGINE` and `Fiddle::WINDOWS` should not change in a process, no
need to be checked inside the methods.

Also, `win32_last_error` and `win32_last_socket_error` are equal to
`last_error` on JRuby.

# Returns the last +Error+ of the current executing +Thread+ or nil if none
def self.last_error
if RUBY_ENGINE == 'jruby'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmh, actually FFI.last_error{,=} should also use FFI.errno on TruffleRuby, it seems somehow I missed this, maybe because there are no tests for this?

Orthogonal to this PR, so feel free to merge this first.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah it wasn't caught because of

def test_last_error
if ffi_backend?
omit("Fiddle.last_error doesn't work with FFI backend")
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=> #173

@kou kou changed the title Define Fiddle.last_error family statically Define Fiddle.last_error family and dlopen statically Jan 31, 2025
@kou kou changed the title Define Fiddle.last_error family and dlopen statically Define Fiddle.last_error family and Fiddle.dlopen statically Jan 31, 2025
@kou kou merged commit 50ac00e into ruby:master Jan 31, 2025
66 checks passed
@nobu nobu deleted the last_error-per-implementation branch February 1, 2025 08:08
matzbot pushed a commit to ruby/ruby that referenced this pull request Feb 3, 2025
statically
(ruby/fiddle#172)

`RUBY_ENGINE` and `Fiddle::WINDOWS` should not change in a process, no
need to be checked inside the methods.

Also, `win32_last_error` and `win32_last_socket_error` are equal to
`last_error` on JRuby.

ruby/fiddle@50ac00ed53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants