[Mono-dev] Embedded Mono/Program freezes

Robert Jordan robertj at gmx.net
Wed Aug 23 15:34:40 EDT 2006

Hi Sebastien,

I'm not sure whether my assumptions were correct, because I'm
not using the VS.NET build at all. I've just scanned the project
files for defines that could prevent libgc from detecting new
threads. GC_NOT_DLL is definitely such a define, because it prevents
DllMain () (where new threads are announced) from being compiled.

Now I'm surprised to see that libmono.vcproj and libgc.vcproj are
static libraries, so removing GC_NOT_DLL won't help.

Embedders have to tweak libgc.vcproj to generate a DLL, otherwise
there is no way to register a thread with the GC.
GC_CreateThread () could be a way, but it requires that the FIXME
in win32_threads.c:GC_thread_is_registered () is resolved.


Sebastien Pouliot wrote:
> Hello Robert,
> Could you apply your patch to the solution files ?
> I'm currently struck with a cygwin that won't build (even if updated,
> reinstalled, deleted, installed...) so I can't make sure everything
> compile afterward.
> Someday I'll check cygwin source code to see where it checks for my
> user's name to inject random faults :-|
> Thanks
> On Sat, 2006-08-19 at 15:56 +0200, Robert Jordan wrote:
>> Janne Rantala wrote:
>>> 2006/8/19, Robert Jordan <robertj at gmx.net>:
>>>> You wrote that you're using mono_runtime_exec_managed_code ().
>>>> If I understand the code correctly, the function will shutdown
>>>> the runtime after the callback terminates. That's probably not
>>>> what you expect, isn't it?
>>>> Try mono_thread_attach () instead of *_exec_managed_code ().
>>>> Note that runtime must reside in a DLL, otherwise
>>>> mono_thread_attach () would fail under Windows.
>>>> Robert
>>> If I do that, I get "Fatal error in gc, collecting from unknown
>>> thread" -error when executing managed code.
>> I just had a look at libmono's VS.NET project file
>> libmono.vcproj:
>> PreprocessorDefinitions="... GC_NOT_DLL ..."
>> GC_NOT_DLL prevents libgc from being able to attach to
>> foreign threads.
>> Try to remove this define.
>> libgc.vcproj also defines GC_NOT_DLL. This must be removed
>> as well.
>> Robert
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list

More information about the Mono-devel-list mailing list