1

Description: My team is developing an application using a third-party DLL. In the beginning, we developed our application using the .NET Framework 4.0. Then we switched to .NET Core 3.1 and continued using Windows. Now we have a task to develop our application for Linux. The third-party DLL we use is written in C or C++. This DLL uses the system libraries: GDI32.dll, KERNEL32.dll and MSVCR100.dll (I used dumpbin.exe to see it). The Linux version of this third-party library does not exist. The developer of this third-party library does not respond to emails.

Question: How can I call the functions of a third-party C/C++ DLL from .Net Core 3.1 on Linux?

Maybe I should use Wine, or winelib, or something else? I'm open to any ideas and suggestions for solving this problem.

UPD: As Iknow this third-party library use GDI32.dll to draw bmp image, because I use that DLL to draw some images by data. I give some data into DLL function and get bmp image.

UPD 2: I also found an interesting project on GitHub. But I'm not sure it will help me because the DLL I use calls functions GDI32.dll.

GoodSimon
  • 121
  • 4
  • you may use wine ... but you have to run whole your .net core app there ... it would be better to find .net replacment for this 3rd party library – Selvin May 25 '22 at 10:40
  • 1
    I would strongly suggest you look at replacing any Windows dependencies. It will only cause you pain. – DavidG May 25 '22 at 10:43
  • 1
    If the DLL uses GDI (e.g. graphics), then it's pretty unlikely you will ever get it running on Linux. – Neil May 25 '22 at 11:00
  • @Selvin, I don't want to run whole application in `Wine'. Is it possible to use proxy library functions? Is it possible to write an application that will use the some API of `Wine` to execute the library code inside `Wine`? Or is the best option in terms of size to create a microservice that will run in "Wine" and call library functions? – GoodSimon May 25 '22 at 11:16
  • @Neil, As Iknow this third-party library use gdi.dll to draw bmp image, because I use that DLL to draw some images by data. I give some data into DLL function and get bmp image. – GoodSimon May 25 '22 at 11:16
  • [it's answer for mono but it apply here too](https://stackoverflow.com/questions/1240973/using-p-invokes-in-mono-through-wine) ... in other words you are installing windows .net core on wine and then use it to run your app ... it may work ... but again it would be better to find .net replacment for this dll – Selvin May 25 '22 at 11:18
  • @Selvin, unfortunately, the this library is designed specifically for drawing chemical formulas, it is taken from [NIST MS Search](https://chemdata.nist.gov/dokuwiki/doku.php?id=chemdata:start). – GoodSimon May 25 '22 at 11:33
  • You need to download runtime version of core and install on each machine. The version of core has to match version you used to compile. See : https://dotnet.microsoft.com/en-us/download?force_isolation=true – jdweng May 25 '22 at 11:54

0 Answers0