Ruby FFI gem не может открыть файл библиотеки - PullRequest
2 голосов
/ 31 октября 2019

У меня есть два файла по одному пути, functions.dll и functions.rb, которые имеют это содержимое:

require 'ffi'

module Foos
  extend FFI::Library
  ffi_lib 'functions'
end

Когда я запускаю это, он выдает:

Traceback (most recent call last):

        4: from functions.rb:6:in <main>
        3: from functions.rb:9:in <module:Foos>
        2: from C:/Ruby/lib/ruby/gems/2.5.0/gems/ffi-1.11.1-x64-mingw32/lib/ffi/library.rb:98:in ffi_lib
        1: from C:/Ruby/lib/ruby/gems/2.5.0/gems/ffi-1.11.1-x64-mingw32/lib/ffi/library.rb:98:in map

C:/Ruby/lib/ruby/gems/2.5.0/gems/ffi-1.11.1-x64-mingw32/lib/ffi/library.rb:151:in block in ffi_lib: Could not open  (LoadError): The specified module could not be found.
Could not open library 'functions.dll': The specified module could not be found.


Любойидея, почему он не может найти файл?

1 Ответ

0 голосов
/ 13 ноября 2019

Укажите полный путь.

ffi_lib File.dirname(__FILE__) + '/functions.dll'

или

ffi_lib File.dirname(__FILE__) + '/functions'
...