Search code examples
.netlinuxmonounmanagedmanaged

Use a mixed-mode (managed/unmanaged) dll on Linux (mono)


I need to port a .NET library to Linux to run with Mono.

The Library itself is written in C#, but it references another mixed-mode DLL written with both managed and unmanaged C++ and exposes managed wrappers to the unmanaged classes.

I'm assuming the dll wouldn't just work on Linux seeing as it was compiled with VS for windows.

PS: the mixed-mode dll only links libpng and zlib which both have Linux ports.

1) Is there any easy way around this?

2) Can WINE be somehow used in conjunction with mono to cover the unmamaged part of the library? And if so, will that cause performance issues?


Solution

  • Mono does not support mixed mode assemblies, so you might try if WINE can help.

    The feasible approach is to use CppSharp, https://github.com/mono/CppSharp