multiple definition of __mingwthr_key_dtor

Danny Smith dannysmith@clear.net.nz
Tue Feb 22 12:49:00 GMT 2005


Danny Smith wrote:
> Ranjit Mathew wrote:
>> Danny Smith wrote:
>>> This is not the best solution, but to get rid of the multiple definition
>>> errors when linking in C++ objects, link with -lgcj -lstdc++ (in that
>>> order). This will bring in the libgcj:win32.cc definitions of the
>>> symbols. The problem with this workaround is that it means your C++
>>> module(s) will leak memory if they create threads, since they will be
>>> using libgcj's bogus definition of __mingwthr_key_dtor.
>>>
>>> Really this should be reported as a bug if one for this problem doesn't
>>> already exist.
>>
>> I hope you have seen:
>>
>>   http://gcc.gnu.org/ml/java/2002-03/msg00082.html
>>
>> and related messages.
>

Also, note that all this __mingw_thread_key_dtor business is only needed with
SJLJ exceptions.
It is only called when initializing  a function context key in unwind-sjlc.c
Maybe the best way to get rid of this whole problem would to use Dwarf2 unwind.
http://gcc.gnu.org/ml/gcc-patches/2004-11/msg01989.html

This would also faciltate use of jcr section to register java classes

I plan to submit an updated  patch for Dwarf2 unwind on mingw after GCC
branches.

Danny




More information about the Java mailing list