Sha256: 0c84913df9725216aa04d8aef154be4af9c8e669b5d2cfd9beebc1d307b7f2c4

Contents?: true

Size: 806 Bytes

Versions: 2

Compression:

Stored size: 806 Bytes

Contents

module ThunderSVM
  module FFI
    extend Fiddle::Importer

    libs = Array(ThunderSVM.ffi_lib).dup
    begin
      dlload Fiddle.dlopen(libs.shift)
    rescue Fiddle::DLError => e
      retry if libs.any?

      if e.message.include?("Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib") && e.message.include?("Reason: image not found")
        raise Fiddle::DLError, "OpenMP not found. Run `brew install libomp`"
      else
        raise e
      end
    end

    extern "void thundersvm_train(int argc, char **argv)"
    extern "void thundersvm_train_after_parse(char **option, int len, char *file_name)"
    extern "void thundersvm_predict(int argc, char **argv)"
    extern "void thundersvm_predict_after_parse(char *model_file_name, char *output_file_name, char **option, int len)"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thundersvm-0.2.0 lib/thundersvm/ffi.rb
thundersvm-0.1.4 lib/thundersvm/ffi.rb