diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-06-26 11:26:56 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-06-26 11:26:56 -0700 |
commit | 4f3006ec3fee281848640a244d3852acaba4e39d (patch) | |
tree | fc32ce1bf35d3b90882914a5e076cee9bd7bb0ec /lib/ffi_yajl | |
parent | 0619ab7f6829599a94e4cc773b5d34b28b3c37ac (diff) | |
download | ffi-yajl-4f3006ec3fee281848640a244d3852acaba4e39d.tar.gz |
fix DL/Fiddle logic stop using ffi
the ffi_lib attempt didn't work. also fix to delay the require of
the 'dl' library until we've determined that Fiddle does not meet
our needs (otherwise we get deprecation warnings even though we
don't wind up using DL).
Diffstat (limited to 'lib/ffi_yajl')
-rw-r--r-- | lib/ffi_yajl/ext.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/ffi_yajl/ext.rb b/lib/ffi_yajl/ext.rb index 2523f9b..504cbe1 100644 --- a/lib/ffi_yajl/ext.rb +++ b/lib/ffi_yajl/ext.rb @@ -8,10 +8,6 @@ begin require 'fiddle' rescue LoadError end -begin - require 'dl' -rescue LoadError -end module FFI_Yajl # FIXME: DRY with ffi_yajl/ffi.rb @@ -21,11 +17,15 @@ module FFI_Yajl libpath = ::FFI.map_library_name("yajl") unless File.exist?(libpath) if defined?(Fiddle) && Fiddle.respond_to?(:dlopen) ::Fiddle.dlopen(libpath) - elsif defined?(DL) && DL.respond_to?(:dlopen) - ::DL.dlopen(libpath) else - extend ::FFI::Library - ffi_lib libpath + # deliberately convoluted delayed require here to avoid deprecation + # warning from requiring dl + require 'dl' + if defined?(DL) && DL.respond_to?(:dlopen) + ::DL.dlopen(libpath) + else + raise "cannot find dlopen in either DL or Fiddle, cannot proceed" + end end class Parser |