ATTN Windows Users: RFC - GCJ/MinGW and Thread-Safe Exception Handling
Danny Smith
dannysmith@clear.net.nz
Tue Jul 4 04:17:00 GMT 2006
Ranjit Mathew wrote:
> Hi,
>> We have a hack in GCJ for MinGW that fools the MinGW
> runtime into thinking that thread-safe exception handling is
> to be used and causes a leak of about 24 bytes of EH context
> per thread as a side-effect.
...
> This has worked all this while except that it is now causing
> multiple definition errors from the linker while creating
> tools like gappletviewer, etc. since these symbols are
> already defined in libmingw32 (don't ask me why we haven't
> faced this issue before - I'm flummoxed myself). In other
> words, it just cannot continue to remain in its current form.
>> I am of the personal opinion that this hack should be removed
> and therefore will be proposing a patch shortly that removes
> this hack and adds the equivalent of "-mthreads" to the linking step.
>
Would this not work?
(1) Put this into a object file of its own and add it to link spec as a
'startup' object so it
overrides the static libmingw.a library version.
int _CRT_MT = 1;
(2) Remove this completely and link against the equivalent one in
mthr_stub.o (libmingw.a)
extern "C" int
__mingwthr_key_dtor (DWORD, void (*) (void *))
{
// FIXME: for now we do nothing; this causes a memory leak of
// approximately 24 bytes per thread created.
return 0;
}
I don't know why I'm suggesting this. I have never liked the foolery in
win32.cc and wopuld be glad to see it removed.
Danny
More information about the Java
mailing list