[Gc] Win32: DLLs and thread registration
gn at fluidon.dyndns.info
Thu Feb 7 23:23:58 PST 2008
Just a little update:
> 1. GC_CreateThread is mapped back to the original
> Windows API version by the exports definitions
> file gc.def. Why that? GC_CreateThread thus
> becomes inaccessible.
Solved. I have removed the gc.def file completely.
> 2. The DLL does not export GC_register_my_thread,
> which makes it hard for applications to register
> their threads manually. Probably GC_API has been
> forgotten in the declaration?
Solved. I have modified the appropriate declarations to include the
> 3. DllMain tests for parallel_initialized==true
> when called during DLL_THREAD_DETACH.
> parallel_initialized, however, is always false
> unless GC_CreateThread (or equivalent) is called.
> DLL_THREAD_ATTACH neither calls any of them nor
> registers the newly attached thread since that
> only happens, when parallel_initialized is true.
Currently I am using a workaround (i.e. ugly hack): at the very
beginning of my programm I once call GC_CreateThread with a dummy thread
procedure which immediately exits. Thus GC_init_parallel gets called
and everything works fine. The actual bug is, I think, that
GC_register_my_thread doesn't call GC_init_parallel.
What's also strange: why does win32_threads.c unconditionally make use
of parallel marking (without checking whether PARALLEL_MARK is
#defined)? Perhaps I should try to #define it myself. That would make
GC_init_inner call GC_init_parallel and could solve my problem.
I'll try that.
More information about the Gc