Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are general steps for me to port my project to mono?

I have a dll. and visual C++ source for it. (my dll is visual c++ wraper around some ffmpeg av* libs - another precompiled dll's) while in the same solution (.sln) I have C# project that uses my dll.

what are general steps for me to port my project to mono?

like image 318
Rella Avatar asked Aug 19 '10 19:08

Rella


2 Answers

Mono does not support mixed-mode assemblies on non-Windows operating systems.

Remove your C++ wrapper and rewrite your application to only use P/Invoke to call into native code.

See also: www.mono-project.com/CPlusPlus

like image 183
dtb Avatar answered Nov 12 '22 11:11

dtb


Compile your project in Visual Studio, but enable the following compiler options:

  • /clr:pure: This will make a pure CLR assembly (without any x86/x86-64 asm), that should run on mono, unless you use some C runtime calls (CRT).
  • /clr:safe: The same as pure, but you can't have CRT references, so your project might not compile. If it doesn't, replace those function calls with other portable calls.

The resulting assembly should be pure CLR and will work with Mono.

This page contains everything you might encounter when compiling a version that works on Mono.

like image 31
Dr. Snoopy Avatar answered Nov 12 '22 11:11

Dr. Snoopy