[Mono-osx] Please help: embedding Mono in a Cocoa application

iamphi iamphi at gmail.com
Mon Aug 24 12:51:29 EDT 2009


In XCode, try debugging with Run->Debug .  Debug sometime stops at different
location on the execution stack than using Run->Run, and may gives you an
error code (segfault, segenv ...) .  

Phi


gevik wrote:
> 
> Hi, 
>   
> So far I am able to compile and link mono with my cocoa application. 
> I have a simple window with a button. After clicking the button I am
> trying to execute the code that is provided in
> "mono/samples/embed/teste.c". 
> 
> I also have a HelloWorld.cs=>HelloWorld.exe application. 
> 
> The first time I click on the button everything goes OK and the
> HelloWorld.exe gets executed. 
> The second time I click on the button, the cocoa application crashes. Has
> anyone encountered a similar problem? 
> 
> There is also nothing in the debug window about the crash. 
> 
> Any advice? 
> 
> here is my sample code: 
> 
> ---------------------------------------------------------------------------------- 
> -(IBAction) testButton:(id)sender 
> { 
>         MonoDomain *domain; 
>         MonoAssembly *assembly; 
>         
>         mono_config_parse ("config"); 
>         NSString *file = [NSString
> stringWithString:@"/Users/gevik/mono2/tests/HelloWorld.exe"]; 
>         domain = mono_jit_init ([file UTF8String]); 
>         
>         if(!domain) 
>         { 
>                 NSLog(@"Domain load error.."); 
>                 return; 
>         } 
>         
>         assembly = mono_domain_assembly_open (domain, [file UTF8String]); 
>         if(!assembly) 
>         { 
>                 NSLog(@"Assembly load error.."); 
>                 return; 
>         } 
>         
>         NSString *exeName = [[NSBundle mainBundle] executablePath]; 
> 
>         const char* argv[] = { 
>                 [exeName UTF8String] 
>         }; 
>         
>         NSLog(@"%@",exeName); 
>         mono_jit_exec (domain, assembly, 1, (char**)argv);	
>         mono_jit_cleanup (domain); 
> } 
> 

-- 
View this message in context: http://www.nabble.com/Please-help%3A-embedding-Mono-in-a-Cocoa-application-tp25076141p25119527.html
Sent from the Mono - OSX mailing list archive at Nabble.com.



More information about the Mono-osx mailing list