Skip to content

Commit

Permalink
Use the Ruby files of the FFI gem on TruffleRuby >= 20.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Apr 11, 2020
1 parent d4fc60b commit 99f1764
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/ffi.rb
Expand Up @@ -8,10 +8,14 @@

require 'ffi/ffi'

elsif RUBY_ENGINE == 'jruby' && Gem::Version.new(JRUBY_VERSION) >= Gem::Version.new("9.3.pre")
elsif RUBY_ENGINE == 'jruby' && Gem::Version.new(RUBY_ENGINE_VERSION) >= Gem::Version.new("9.3.pre")
JRuby::Util.load_ext("org.jruby.ext.ffi.FFIService")
require 'ffi/ffi'

elsif RUBY_ENGINE == 'truffleruby' && Gem::Version.new(RUBY_ENGINE_VERSION) >= Gem::Version.new("20.1.0")
require 'truffleruby/ffi_backend'
require 'ffi/ffi'

else
# Remove the ffi gem dir from the load path, then reload the internal ffi implementation
$LOAD_PATH.delete(File.dirname(__FILE__))
Expand Down

0 comments on commit 99f1764

Please sign in to comment.