Skip to content

Commit

Permalink
Use RbConfig to determine the file name of the library
Browse files Browse the repository at this point in the history
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 435eb0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/cld3.rb
Expand Up @@ -18,6 +18,7 @@
# ==============================================================================

require "ffi"
require "rbconfig"

# Module providing an interface for Compact Language Detector v3 (CLD3)
module CLD3
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 435eb0d

Please sign in to comment.