[Mono-dev] FAQ:Technical: Question 2.9: Running Visual C++/CLI programs under mono

platoswelt-member at yahoo.de platoswelt-member at yahoo.de
Sun Feb 5 22:18:53 EST 2006

I am interested in making C++/CLI work with Mono,
because I like my programs to run under Linux, but
being myself to lazy and reluctant to move just
because of this from C++ to C#.

Using C++/CLI to create a pure managed executable
which runs under Mono is easy: In your CLR project
just specify in the general configuration properties
"Safe MSIL Common Language Runtime Support
(/clr:safe)" and all dependencies to the C Runtime
Library (CRT) are gone!
You can use PEVerify.exe to check it.

Found this in the blog here:

Quick Tutorial (I am using Visual Studio 2005 Beta2):
- Create an empty CLR project "TestApp"
- Add a new source file "Main.cpp"
- Enter the following code:
using namespace System;
int Main(void){
	Windows::Forms::MessageBox::Show("Welcome to Mono
C++/CLI!", "TestApp",
	return 0;}

- Select Project->References..->Add Reference adding
"System.dll" and "System.Windows.Forms.dll"
- Select Project->Configuration
Properties->General->Project Defaults->Common Language
Runtime Support-> /clr:safe
- Select Project->Linker->System->SubSystem: Windows
- Select Project->Linker->Advanced->Entry: Main
- Build the project and run the executable "mono

However when adding a simple dialog Windows::Form
"MyForm" and calling 
Application::Run(gcnew TestApp::MyForm());
from Main, mono fails to run TestApp :(

°°°A   }    }
[..... J/~~~~~~~~~~~~~o~~~o~~~~~~
~ Ruf: 0381-8099114 ~~~~~~~~~~~~~
~~~~~~~~~ Mobil: 0179-5737433 ~~~


Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

More information about the Mono-devel-list mailing list