Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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

Thanks for the help.

Greetings!

like image 432
Lobo Avatar asked Dec 31 '10 10:12

Lobo


2 Answers

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.

like image 139
MarkR Avatar answered Oct 14 '22 06:10

MarkR


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.

like image 45
Brian Agnew Avatar answered Oct 14 '22 06:10

Brian Agnew