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

gevik g.babakhani at truesoftware.nl
Fri Aug 21 06:19:09 EDT 2009

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
        domain = mono_jit_init ([file UTF8String]); 
                NSLog(@"Domain load error.."); 
        assembly = mono_domain_assembly_open (domain, [file UTF8String]); 
                NSLog(@"Assembly load error.."); 
        NSString *exeName = [[NSBundle mainBundle] executablePath]; 

        const char* argv[] = { 
                [exeName UTF8String] 
        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-tp25076141p25076141.html
Sent from the Mono - OSX mailing list archive at Nabble.com.

More information about the Mono-osx mailing list