lib/lightgbm/ffi.rb in lightgbm-0.1.3 vs lib/lightgbm/ffi.rb in lightgbm-0.1.4
- old
+ new
@@ -1,10 +1,16 @@
module LightGBM
module FFI
extend ::FFI::Library
- ffi_lib ["lightgbm", "lib_lightgbm.so"]
+ begin
+ ffi_lib LightGBM.ffi_lib
+ rescue LoadError => e
+ raise e if ENV["LIGHTGBM_DEBUG"]
+ raise LoadError, "Could not find LightGBM"
+ end
+
# https://github.com/microsoft/LightGBM/blob/master/include/LightGBM/c_api.h
# keep same order
# error
attach_function :LGBM_GetLastError, %i[], :string
@@ -13,10 +19,10 @@
attach_function :LGBM_DatasetCreateFromFile, %i[string string pointer pointer], :int
attach_function :LGBM_DatasetCreateFromMat, %i[pointer int int32 int32 int string pointer pointer], :int
attach_function :LGBM_DatasetGetSubset, %i[pointer pointer int32 string pointer], :int
attach_function :LGBM_DatasetFree, %i[pointer], :int
attach_function :LGBM_DatasetSaveBinary, %i[pointer string], :int
- attach_function :LGBM_DatasetDumpText, %i[pointer string], :int
+ # attach_function :LGBM_DatasetDumpText, %i[pointer string], :int
attach_function :LGBM_DatasetSetField, %i[pointer string pointer int int], :int
attach_function :LGBM_DatasetGetField, %i[pointer string pointer pointer pointer], :int
attach_function :LGBM_DatasetGetNumData, %i[pointer pointer], :int
attach_function :LGBM_DatasetGetNumFeature, %i[pointer pointer], :int