[Mono-dev] Embedding Mono into C++
Frank Fuchs
fk.fuchs at googlemail.com
Sun Jul 25 15:35:30 EDT 2010
Wow I almost missed your answer. It works like a charm! Thank you!
> On 24.07.2010 15:11, Frank Fuchs wrote:
>>
>> On a related note is there a way to invoke the mcs compiler from within the code to compile some .cs file.
>> Of course one could try to invoke mcs with a system call or ExecuteProcess but is there something more convenient?
>> As far as I read about the evaluator it seems not to so well suited for this purpose since i don't want/ need line-by-line action or repl.
>
>
> Look at System.CodeDom.Compiler.CodeDomProvider. Something like that:
>
> CodeDomProvider provider = CodeDomProvider.CreateProvider ("C#");
> CompilerParameters parms = new CompilerParameters ();
> params.GenerateExecutable = true;
> params.OutputAssembly = "test.exe";
> provider.CompileAssemblyFromFile (parms, new string [] {"test.cs"});
>
> Then wrap this code in a handy C# method that can be
> conveniently mono_runtime_invoke()-ed from C++.
>
> Robert
More information about the Mono-devel-list
mailing list