Calling .dll in linux environment in c++

328 Views Asked by At

I have windows dynamic linked library which I want to access from Linux environment. I don't have the source code of that library, so I cannot build .so file.

Is there a way by using Winelib or any other library or tool for converting library file to .so file, so that I can call functions defined in that library?

1

There are 1 best solutions below

0
On

There is no easy way to do it, because the DLL cannot run in Linux enviromnemt all by itself. It will probably rely on user32.dll msvcrt.dll and friends at runtime, so you'll have to provide those files as well.

You can use winelib, but it doesn't just convert a .dll to an .so. You'll have to link the whole project that wants to call the DLL against winelib, and include the DLL itself with your app at runtime. If you are trying to port a Windows app to Linux, winelib will be able to convert your makefile for you, but it's far from automatic for complex projects.