Ruby C 扩展无法在运行时解析第 3 方 dll
我有一个 Ruby C 扩展,它提供了一个 ruby 接口来使用第三方 C 库。我能够构建这个库,让我们称之为某个东西吧。所以就很好了。但是,它是针对第三方 .lib 和 .dll 文件动态编译的。
当我实际尝试运行 ruby 脚本时,它
require 'something'
失败了。 Ruby 不知道如何找到 some.so 所链接的 DLL。它给了我一个错误,例如:
--------------------------- ruby.exe - System Error --------------------------- The program can't start because SomeThirdParty.dll is missing from your computer. Try reinstalling the program to fix this problem. --------------------------- OK ---------------------------
我需要做什么来告诉 ruby 如何找到这个 dll?如果我将所有第三方 dll 放在与我运行的 ruby 脚本相同的目录中,它就可以工作,但我不想这样做。
I have a Ruby C extension that is providing a ruby interface to use a third part C library. I am able to build the library, let's call it something.so just fine. However, it's compiled against the third party .lib and .dll files dynamically.
When I actually try to run a ruby script that has
require 'something'
it fails. Ruby doesn't know how to find the DLLs the something.so was linked against. It gives me an error like:
--------------------------- ruby.exe - System Error --------------------------- The program can't start because SomeThirdParty.dll is missing from your computer. Try reinstalling the program to fix this problem. --------------------------- OK ---------------------------
What do I need to do to tell ruby how to find this dll? If I put all the third party dlls in the same directory as the ruby script I'm running it works, but I'd rather not do that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需将其放在您的 PATH 内的位置即可。 ruby\bin 目录可能是一个好地方。
Just put it in a place that is inside your PATH. A good place may be the
ruby\bin
directory.