Windows DLL on Linux System

10,340

Solution 1

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.

Solution 2

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.

Solution 3

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

Solution 4

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

Solution 5

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.

Share:
10,340
Lobo
Author by

Lobo

Software Engineer

Updated on July 27, 2022

Comments

  • Lobo
    Lobo almost 2 years

    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!

  • BatchyX
    BatchyX over 13 years
    Wine Is Not an Emulator, it's a compatibility layer. It doesn't work if your not in a x86 or amd64 architecture.