gpt4 book ai didi

Ruby FFI gem 无法打开库文件

转载 作者:行者123 更新时间:2023-12-04 04:22:55 26 4
gpt4 key购买 nike

我在同一路径中有两个文件,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.



知道为什么它可能找不到文件吗?

最佳答案

提供完整路径。

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

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

关于Ruby FFI gem 无法打开库文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58648534/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com