[Mono-dev] CodeDomProvider.CreateProvider fails on Windows

Robert Jordan robertj at gmx.net
Thu Jul 29 13:16:32 EDT 2010


Hey,

On 29.07.2010 18:52, Frank Fuchs wrote:
> Yes I did. otherwise the mono_jit_init  wouldn't work, and I was not able to start the C# routines.

Yeah, my bad.

I believe the issue is more profane: Mono is trying to launch
gmcs with bin/gmcs.bat, but the latter contains absolute paths
set by the Mono installer => the script is not relocatable.

Change gmcs.bat to look like this:

@"%~dp0\mono.exe" %MONO_OPTIONS% "%~dp0\..\lib\mono\2.0\gmcs.exe" %*


%~dp0 (a cmd.exe variable) is expanded to the actual path of
gmcs.bat, making the script relocatable.

Robert


> However, this works well also for rather complicated routines interacting with the host-app.
> The specific c# programm exits at the CodeDomProvider.CreateProvider call.
>
> -Frank
>
>
>> Date: Thu, 29 Jul 2010 11:22:24 +0200
>> From: Robert Jordan<robertj at gmx.net>
>> Subject: Re: [Mono-dev] CodeDomProvider.CreateProvider fails on
>> 	Windows
>> To: mono-devel-list at lists.ximian.com
>> Message-ID:<i2rh8d$9fd$1 at dough.gmane.org>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> On 29.07.2010 09:25, Frank Fuchs wrote:
>>> Hi,
>>>
>>> I'd like to compile .cs files at runtime. Following the tip frome here
>>> http://lists.ximian.com/pipermail/mono-devel-list/2010-July/035505.html I'm
>>> able to do that on my Mac. On Windows (win 7 enterprise) however I do not
>>> manage to get it running.
>>> The program exits with exit code 01 right when calling
>>> CodeDomProvider.CreateProvider("C#"). I'm using mono in a relocated setup
>>> (no admin rights on the windows machine).
>>> Strangely the program executes well when I call the assembly with mono from
>>> command line, but fails when calling it from the embedding c++ application
>>
>> Are you calling mono_set_dirs() [1] from C++?
>>
>> Mono for Windows needs this call because libmono cannot detect
>> relocations under Windows.
>>
>> Robert
>>
>> [1] http://preview.tinyurl.com/39d57tg
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list