Ruby C 扩展无法在运行时解析第 3 方 dll

发布于 2024-12-07 04:22:11 字数 621 浏览 4 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

横笛休吹塞上声 2024-12-14 04:22:11

只需将其放在您的 PATH 内的位置即可。 ruby\bin 目录可能是一个好地方。

Just put it in a place that is inside your PATH. A good place may be the ruby\bin directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文