R. Joiny R. Joiny - 9 months ago 43
Linux Question

Using software libraries written for windows (using dlls) in linux

This is a possible duplicate to this question but the answer is not solving my problem...

I want to use third party software delivered by c++ headers, libraries (.lib) and dlls for a project. Because it will run on a BeagleBone, I am writing this project for Linux. Is there any proper way to link dlls for Linux applications?

Answer Source

Highly unlikely to ever work:

  1. Windows uses a different file-format for executable files (and DLL's are essentially executable files - same for shared libraries in Linux). This means that relocation information and symbol linkage is different.

  2. Even if you manage to load and relocate the DLL, you most likely will need many other DLL's (such as the compiler runtime and system runtime [kernel32.dll for example]) to actually run the application. And of course, those dependent files need to have a correct interface to work on Linux (see #3)

  3. There's nothing stopping a Windows DLL from making system calls directly in the shared library - these won't work in Linux.

Your best choices are:

  1. Request Linux versions from the supplier of those libraries. Depending on what the functionality is, it may or may not be an easy task for the supplier to produce alternatives for different architectures.
  2. Run the application inside the WINE (WINdows Emulator) package.
  3. Run a Windows virtual machine, and run the application inside that.
  4. Write your own replacement libraries, or find others already available out there.