[Mono-dev] Embedding Mono

Tom Spink tspink at gmail.com
Tue Mar 22 14:48:47 EDT 2011


On 18 March 2011 10:48, vinay_rk <vinay.kashyap at ironmountain.com> wrote:
> Hi,
>
> After several tests with Mono Embedding on Mac OSX on returning to Windows,
> I see that the first issue that I started this thread with is still the same
> on windows (Things seem to be fine on Mac). The code I have on windows is as
> follows:
>
> MonoDomain *domain;
>        MonoAssembly *assembly;
>        char *args[1];
>        args[0] = "Test Param";
>        //mono_config_parse(NULL);
>        //mono_set_dirs(NULL,NULL);
>
>    domain = mono_jit_init
> ("C:\Work\CommonAgent\TestManagedAssembly\TestManagedAssembly\bin\Debug\TestManagedAssembly.exe");
>        assembly = mono_domain_assembly_open (domain,
> "C:\Work\CommonAgent\TestManagedAssembly\TestManagedAssembly\bin\Debug\TestManagedAssembly.exe");
>
>        if (!assembly)
>                printf("Error");
>        else
>        {
>                mono_jit_exec (domain, assembly,1, args);
>        }
>
> While mono_jit_init gets a valid looking pointer, the
> mono_domain_assembly_open returns a null pointer. Is this because of
> something I did wrong with the mono.lib I' am linking against.. ? I created
> the Mono.lib using the mono.def file and with the command:  lib /nologo
> /def:mono.def /out:mono.lib /machine:x86. should I ensure the mono.def file
> is copied in some particular directory amongst the mono framework
> installation (directory structure) ?
>
> PS: If I try un-commenting the calls to either mono_config_parse or
> mono_set_dirs, then the mono_jit_init crashes without any particular
> exception.
>
> This is looking like a complete dead end as of now.. !
>
> Regards
> -Vinay
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Embedding-Mono-tp3345310p3386882.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>

Hi,

You need to put double backslashes in your path name, as a single
backslash is an escape character, in a string literal.

e.g.:

"C:\\Work\\CommonAgent\\TestManagedAssembly\\TestManagedAssembly\\bin\\Debug\\TestManagedAssembly.exe"

Tom.


More information about the Mono-devel-list mailing list