[Mono-list] Mono embedding issue

Andreas Färber andreas.faerber at web.de
Tue Oct 10 06:29:14 EDT 2006

Hello Robert,

Thanks for your quick replies!

>> When embedding Mono on OS X i386, I get an assertion failure
>> in mono_jit_init:
>> ** ERROR **: file threads.c: line 420 (mono_thread_attach): assertion
>> failed: (thread_handle)
>> aborting...
> This basically means that io-layer's GetCurrentThread returned
> NULL, which is completely nonsense because it always returns
> a constant value != NULL.
> I suppose MacOS has its own GetCurrentThread function which gets
> linked and called instead Mono's:
> http://bugzilla.ximian.com/show_bug.cgi?id=77324

I already read that bug report. It refers to _GetCurrentProcess as  
opposed to GetCurrentThread.

I do get a linker warning only for the _GetCurrentProcess symbol, as  
mentioned in #77324; my workaround is to add -undefined  
dynamic_lookup to the linker flags in Xcode, which also eliminates  
the error for the _environ symbol. The only remaining warning then  
was Mono.framework not being Universal, which I can safely ignore as  
I am recompiling on both platforms against the native one installed.

Please do note that my code works on ppc, so it's unlikely to be a  
general OS X API problem.

I would of course appreciate some solution to the name conflict,  
possibly as outlined in the bug comments by Paolo in April.
My native code is a Cocoa bundle, linked to Cocoa.framework,  
DevToolsCore.framework and Mono.framework. The other  
_GetCurrentProcess seems to originate somewhere from the  
Cocoa.framework, which is the basis for all object-oriented bundles  
on OS X.

My method calling mono_jit_init is a regular (non-initialize)  
Objective-C class method. Since yesterday that is to be exact -  
before that I had the Mono embedding in a separate library's  
initialization routine, spawning a pthread to avoid deadlock,  
yielding virtually identical results (ppc worked, i386 didn't).

One machine is a Dual Core PowerPC G5, the other an Intel Core Duo,  
so both dual-core. The only difference I just noticed is OS X v10.4.8  
on ppc and v10.4.7 on i386, but both are running Xcode 2.4. Will  
check on that but I'm not too optimistic...


More information about the Mono-list mailing list