« Return to Thread: mingwm10.dll

Re: mingwm10.dll

by Brian Dessent :: Rate this Message:

Reply to Author | View in Thread

???????? ?????????? wrote:

> So, can somebody tell me then how can I remove the dependency on
> `mingwm10.dll' even if I *do* need the functionality?

You can, but you'll suffer a memory leak.  From the comment in
mthr_init.c:

 * The sole job of the Mingw thread support DLL (MingwThr) is to catch
 * all the dying threads and clean up the data allocated in the TLSs
 * for exception contexts during C++ EH. Posix threads have key dtors,
 * but win32 TLS keys do not, hence the magic. Without this, there's at
 * least `24 * sizeof (void*)' bytes leaks for each catch/throw in each
 * thread.

> I.e., what if I need threads with exceptions AND want to have my program
> in a single executable?

I don't think that's possible, since the functionality of cleaning up
these TLS keys is dependant on receiving DLL_THREAD_DETACH messages,
which can only be seen from DllMain.  So some DLL somewhere in your
process' address space would have to do this.  In the case of using MS's
tools since they control msvcr*.dll they can do it there, but we don't
have that luxury.

> __mingwthr_key_dtor
> __mingwthr_remove_key_dtor
>
> The file is only 15649 bytes long (with no licensing difficulties
> AFAIK), but the inconvenience of having to distribute it together with
> programs which could (and should) have been distributed as single
> executables I must say is significant...  (as well as the inconvenience
> of explaining to your boss why it's not working when you didn't even
> *know* you were using that DLL!!!)
>
> So, does anyone know (or can refer to some documentation explaining)
> *exactly* what `mingwm10.dll' does?

As the comment above says, its sole purpose is to free TLS variables
when a thread detaches.  If you can arrange for some other way for this
to happen, then you can circumvent the need for this DLL.  I can't think
of any, and I'm pretty sure that in all the past threads on this topic
nobody else presented a workable solution.

Brian

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

 « Return to Thread: mingwm10.dll