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

Gevik Babakhani gevik at xs4all.nl
Fri Aug 21 13:45:56 EDT 2009


Hi,

I did that. But without shutting down the runtime I get the following crash.

ERROR:domain.c:1226:mono_init_internal: code should not be reached
Stacktrace:

I wonder what      "2   ???                                 0xffffffff 
0x0 + 4294967295"
means

Native stacktrace:

    0   libmono.0.dylib                     0x003ba601 
mono_handle_native_sigsegv + 241
    1   libSystem.B.dylib                   0x966f82bb _sigtramp + 43
    2   ???                                 0xffffffff 0x0 + 4294967295
    3   libSystem.B.dylib                   0x9676c23a raise + 26
    4   libSystem.B.dylib                   0x96778679 abort + 73
    5   libglib-2.0.0.dylib                 0x00150152 
g_assertion_message + 258
    6   libmono.0.dylib                     0x004157a1 
mono_get_exception_class + 4337
    7   libmono.0.dylib                     0x00343bd1 mini_init + 3137
    8   libmono.0.dylib                     0x003a0549 mono_jit_init + 25
    9   MyMonos                             0x00001e41 main + 151
    10  AppKit                              0x90977e8f 
_NXDoMouseUpWindowOrdering + 1532
    11  AppKit                              0x90977dcc 
_NXDoMouseUpWindowOrdering + 1337
    12  AppKit                              0x90977c52 
_NXDoMouseUpWindowOrdering + 959
    13  AppKit                              0x909772ab 
_NXDoDeferredWindowOrdering + 4924
    14  AppKit                              0x90976afe 
_NXDoDeferredWindowOrdering + 2959
    15  AppKit                              0x909763b8 
_NXDoDeferredWindowOrdering + 1097
    16  AppKit                              0x90974af7 
_NXIndexToCursorRect + 7081
    17  AppKit                              0x909416a5 
_NSHandleCarbonMenuEvent + 6450
    18  AppKit                              0x9089efe7 
_NSSetViewMultiClipDrawingHelper + 4938
    19  AppKit                              0x9086c1d8 NSApplicationMain 
+ 574
    20  MyMonos                             0x00001dd4 main + 42
    21  MyMonos                             0x00001d7e start + 54
    22  ???                                 0x00000001 0x0 + 1


Martin Smith wrote:
> Hello,
>
> Why are you trying to shut down the runtime?  I wonder if there's a 
> problem and the runtime is not getting closed which is causing a 
> problem launching a second time.
>
> Martin
>
> On Fri, Aug 21, 2009 at 3:19 AM, gevik <g.babakhani at truesoftware.nl 
> <mailto:g.babakhani at truesoftware.nl>> 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-tp25076141p25076141.html
>     Sent from the Mono - OSX mailing list archive at Nabble.com.
>
>     _______________________________________________
>     Mono-osx mailing list
>     Mono-osx at lists.ximian.com <mailto:Mono-osx at lists.ximian.com>
>     http://lists.ximian.com/mailman/listinfo/mono-osx
>
>



More information about the Mono-osx mailing list