简体   繁体   English

Linux系统上的Windows DLL

[英]Windows DLL on Linux System

I wonder if you can load a DLL , of Windows operating system (for example, user32.dll), in an application (in any programming language) with a Linux operating system. 我想知道你是否可以在Linux操作系统的应用程序 (使用任何编程语言)中加载 Windows操作系统的DLL (例如,user32.dll)。

The DLL would be in a directory on the Linux file system. DLL将位于Linux文件系统上的目录中。

Thanks for the help. 谢谢您的帮助。

Greetings! 问候!

Yes, you can load a DLL and call its functions by using an appropriate wrapper library, but that's fundamentally useless if the DLL itself has dependencies on the platform which are not present. 是的,您可以通过使用适当的包装器库来加载DLL并调用其函数,但如果DLL本身具有不存在的平台依赖性,那么这基本上是无用的。 This approach is used for things like closed-source video codecs, where no (nontrivial) dependencies exist. 这种方法用于闭源视频编解码器之类的东西,其中不存在(非平凡的)依赖性。

User32.dll is of course, part of the OS and intrinsically linked to many NT kernel functions, none of which exist in Linux. User32.dll当然是操作系统的一部分,并且与许多NT内核函数有内在联系,Linux中没有这些函数。 Wine does not make use of the Windows user32.dll, but provides its own version which gives equivalent functionality. Wine不使用Windows user32.dll,但提供了自己的版本,它提供了相同的功能。

Loading Windows' user32.dll would definitely not be useful, as it is mostly going to be a wrapper for other DLLs, processes (for example CSRSS) and kernel calls which aren't present under Linux. 加载Windows'user32.dll肯定没用,因为它主要是其他DLL,进程(例如CSRSS)和Linux下不存在的内核调用的包装器。 You could load and use Wine's one though. 你可以加载和使用Wine的。

No. The architectures are fundamentally different. 不,架构根本不同。

I note your question is tagged C++. 我注意到你的问题被标记为C ++。 If it was a .net DLL (built with CLR bytecode) then you could reference it via an application running under Mono. 如果它是.net DLL(使用CLR字节码构建),那么您可以通过在Mono下运行的应用程序引用它。

It's possible if you write a wrapper for it. 如果你为它编写一个包装器,这是可能的。 That's how the win32 codecs work on Linux. 这就是win32编解码器在Linux上的工作方式。 Also Wine uses many DLLs. Wine也使用了很多DLL。

You could probably do a custom Wine build ( home page , Wikipedia page ) for your application. 您可以为您的应用程序执行自定义Wine构建( 主页Wikipedia页面 )。 We're talking about a big hammer here, though. 不过,我们在这里谈论的是一把锤子。 :-) :-)

DLL is a format for windows (ie it MS implementation of shared library concept). DLL是一种用于windows的格式(即它是共享库概念的MS实现)。
It is not in a format that Linux understands. 它不是Linux理解的格式。
Linux uses the ELF format for dynamic libraries. Linux将ELF格式用于动态库。

Why do you want to do this? 你为什么要这样做? To execute a program ( .exe ) that uses that DLL? 要执行使用该DLL的程序( .exe )? In that case you need a Windows emulator on your Linux machine, such as wine . 在这种情况下,您的Linux机器上需要一个Windows模拟器,例如wine

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java(Linux)和Windows系统之间的字符编码 - Character encoding between Java (Linux) and Windows system 如何在Linux JVM中使用本机Windows DLL - How to use a native windows DLL inside a Linux JVM 在Linux下从Java访问Windows dll(可能通过Wine) - Access a Windows dll from Java under Linux (probably through Wine) InetAddress.getLocalHost 是否提供 Windows 和 Linux 系统的 ip 地址? - Does InetAddress.getLocalHost give ip address of Windows and Linux System? 如何在Windows / Linux / MacOS上的系统启动时运行Java应用程序? - How to run Java application at system startup on Windows/Linux/MacOS? 如何在 Java 中使用操作系统的默认文件选择器(在 Linux 和 Windows 中) - How to use the default File Chooser for the operating system in Java (in Linux and Windows) Shell脚本可以在Linux系统上正常运行,但不能在Windows计算机上运行 - Shell script working fine on linux system but not running on windows machine Linux和Windows数据系统可以共存吗? - Can Linux and Windows data system co-exist Windows和Linux之间的Intellij项目-使用“提供的默认系统” JDK? - Intellij project between Windows and Linux - use the 'default system provided' JDK? 在Linux系统中解析日期时发生运行时异常(在Windows系统中正常工作) - Runtime exception while parsing date in linux system (Working fine in windows system)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM