开发者

Windows DLL on Linux System

开发者 https://www.devze.com 2023-02-02 02:37 出处:网络
I wonder if you can load a DLL, of Windows operating system (for example, user3开发者_开发问答2.dll), in an application (in any programming language) with a Linux operating system.

I wonder if you can load a DLL, of Windows operating system (for example, user3开发者_开发问答2.dll), in an application (in any programming language) with a Linux operating system.

The DLL would be in a directory on the Linux file system.

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. 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. Wine does not make use of the Windows user32.dll, but provides its own version which gives equivalent functionality.

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. You could load and use Wine's one though.


No. The architectures are fundamentally different.

I note your question is tagged C++. If it was a .net DLL (built with CLR bytecode) then you could reference it via an application running under Mono.


It's possible if you write a wrapper for it. That's how the win32 codecs work on Linux. Also Wine uses many DLLs.


You could probably do a custom Wine build (home page, Wikipedia page) for your application. We're talking about a big hammer here, though. :-)


DLL is a format for windows (i.e. it MS implementation of shared library concept).
It is not in a format that Linux understands.
Linux uses the ELF format for dynamic libraries.


Why do you want to do this? To execute a program (.exe) that uses that DLL? In that case you need a Windows emulator on your Linux machine, such as wine.

0

精彩评论

暂无评论...
验证码 换一张
取 消