可以在 Linux 上使用 .dll

发布于 2024-08-26 13:57:35 字数 691 浏览 7 评论 0原文

问题:是否可以使用.dll 文件在Linux 上编译程序?

这将走向何方: 该 .dll 将用于为第三方的某些专有软件编写 php 扩展。

背景和研究:

我得到了一个名为proprietary.lib的库。我很好奇,因为我以前从未见过 .lib 扩展名,所以我输入:

file proprietary.lib

输出是:

proprietary.lib:  current ar archive

我做了一些研究,发现 ar 或多或少是- less tar (事实上,我猜 tar 已经在大多数 *nix 环境中取代了 ar)。

在检查 ar 联机帮助页时,我看到了 t 选项,它显示了该存档内容的表格列表。凉爽的。所以我输入:

ar t proprietary.lib

并得到:

proprietary.dll
proprietary.dll
... (snip X lines) ...

Question: Is it possible to compile a program on linux using a .dll file?

Where this is going:
This .dll will be used to write a php extension to some proprietary software from a third party.

Background and Research:

I have been given a library called proprietary.lib. I was curious, as I have never seen the .lib extension before, so I typed:

file proprietary.lib

The output was:

proprietary.lib:  current ar archive

I did some research and found that ar is more-or-less tar (and in fact, I guess tar has since replaced ar in most *nix environments).

Upon inspecting the ar manpage, I saw the t option, which displays a table listing of the contents of that archive. Cool. So I type:

ar t proprietary.lib

And get:

proprietary.dll
proprietary.dll
... (snip X lines) ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(5

别挽留 2024-09-02 13:57:35

最近的开发可能改变了这种情况:Linux 上有一个 loadlibrary 函数,可以加载Windows DLL,然后调用其中的函数。

因此,如果您拥有的 .dll 文件实际上是 Windows DLL,您可能会找到一种在您的软件中使用它的方法。

Recent development may have changed the situation: There is a loadlibrary function for Linux available, that makes it possible to load a Windows DLL and then call functions within.

So, if the .dll file you have actually is a Windows DLL, you may find a way to use it in you software.

合约呢 2024-09-02 13:57:35

您可以尝试提取 ar 文件(Debian 软件包是 ar 文件,fwiw)并在内容上运行 file

如果没有翻译,您将无法使用 Windows DLL。据我所知,唯一可以在 Linux 上本地运行的 DLL 文件是用 Mono 编译的。

如果有人为您提供了一个专有的二进制库来进行编码,您应该验证它是针对目标体系结构进行编译的(与尝试在 x86 系统上使用 am ARM 二进制文件不同),并且它是针对 Linux 进行编译的。

话虽这么说……祝你好运。我讨厌针对第三方库进行编程,我有文档和源代码。

You could try extracting the ar file (Debian packages are ar files, fwiw) and run file on the contents.

You're not going to be able to use Windows DLLs without translation. The only DLL files that I know of that work natively on Linux are compiled with Mono.

If someone gave you a proprietary binary library to code against, you should verify it's compiled for the target architecture (nothing like trying to use am ARM binary on an x86 system) and that it's compiled for Linux.

That being said...good luck. I hate programming against third-party libraries where I have the documentation and the source.

忱杏 2024-09-02 13:57:35

.dll 文件通常是 Windows 共享库。 (也有可能 Linux 上的某个人构建了一个常规的 Linux 库,并出于某种原因将其称为 .dll。)

您可以使用 葡萄酒。对此的支持曾经是实验性的——我不知道它目前的状态。

.dll files are usually Windows shared libraries. (It's also possible that somebody on Linux has built a regular Linux library and called it .dll for some reason.)

It's possible you could link against them using Wine. Support for this was once in there as experimental - I don't know its current status.

一萌ing 2024-09-02 13:57:35

是的,我们可以在wine的帮助下使用dll。
只需在Linux中安装wine64

sudo apt-get install wine64

Yes We can use dll with the help of wine .
just install wine64 in linux

sudo apt-get install wine64
绻影浮沉 2024-09-02 13:57:35

普通的DLL文件是Windows的链接库,因此它们不能直接在Linux上运行,但是可以使用.NET Core专门为Linux编译DLL文件。

Normal DLL files are Windows' linked libraries, so they cannot run on Linux directly, however it's possible to compile DLL files specifically for Linux using .NET Core.

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