Permalink
Browse files

Use RbConfig to determine the file name of the library

FFI.map_library_name is inappropriate for macOS, where it is different
from the file name determined by mkmf.
Use RbConfig::CONFIG["DLEXT"] instead as mkmf does.
  • Loading branch information...
akihikodaki committed May 10, 2017
1 parent b25b57b commit 435eb0d9365f571faf9b1bb389f246d6d87b7cd4
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/cld3.rb
View
@@ -18,6 +18,7 @@
# ==============================================================================
require "ffi"
+require "rbconfig"
# Module providing an interface for Compact Language Detector v3 (CLD3)
module CLD3
@@ -83,7 +84,7 @@ def self.release(pointer)
module Unstable
extend FFI::Library
- ffi_lib File.join(File.expand_path(File.dirname(__FILE__)), "..", "ext", "cld3", FFI.map_library_name("cld3"))
+ ffi_lib File.join(File.expand_path(File.dirname(__FILE__)), "..", "ext", "cld3", "libcld3." + RbConfig::CONFIG["DLEXT"])
class NNetLanguageIdentifierResult < FFI::Struct
layout :language_data, :pointer, :language_size, :size_t, :probability, :float, :proportion, :float, :reliable?, :bool

0 comments on commit 435eb0d

Please sign in to comment.