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
jruby fixes #821
jruby fixes #821
Conversation
@@ -35,4 +35,4 @@ module LibC | |||
expect(t[:tv_usec]).to be_kind_of(Numeric) | |||
end | |||
end | |||
end | |||
end unless RUBY_ENGINE == 'jruby' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on Windows, gettimeofday doesn't exist in the standard libc library, but cruby redefines it. That's why it cannot be supported on jruby.
lib/ffi/platform.rb
Outdated
@@ -128,7 +128,7 @@ def self.is_os(os) | |||
end | |||
|
|||
LIBC = if IS_WINDOWS | |||
if RbConfig::CONFIG['host_os'] =~ /mingw/i | |||
if RbConfig::CONFIG['host_os'] =~ /mingw|mswin/i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sry, I forget about it. You're right. On JRuby, the Windows platform is always "mswin", but I use GCC as a compiler, so "ucrtbase.dll" library is wrong. Unlike CRuby, JRuby doesn't depend on a C compiler at all, it's optional. We would probably need some kind of runtime check for what the correct library is, it's hard to guess based just on the platform.
I was trying to figure out why's "gettimeofday" test failing, but it's broken anyway (see my other comment), so I just revert the change. Thanks for pointing it out.
spec/ffi/library_spec.rb
Outdated
@@ -64,7 +64,7 @@ class StructUCDP < FFI::Struct | |||
end | |||
end | |||
|
|||
if RbConfig::CONFIG['host_os'] =~ /mingw/ | |||
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similary, this is intended to apply to MINGW only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 reverted
for jruby/jruby#6375