|
Subject: Re: MinGW + Threads + Exceptions + DLLs Newsgroups: gmane.comp.gnu.mingw.user Date: 2007-05-07 08:25:25 GMT (2 years, 8 weeks, 2 days, 16 hours and 6 minutes ago) Brendon Costa Sent: Monday, 7 May 2007 4:42 p.m. > > Now this combination also uses threads and exceptions in C++. I have > found that when throwing exceptions they often do strange things to > the stack like unwinding the stack in a different thread etc (This > sort of thing also happens when -mthreads is not used to compile and > link all the code). > > I have seen similar symptoms before when i wasn't using -mthreads, but > ALL code for this application, static library and DLL are compiled and > linked using -mthreads. > > Reading in archives of the C++ forums i saw that the problem is most > likely because of the static libgcc library that is linked into both > the application and the DLL implicitly by GCC. > > Is this correct or have things changed? > > I.e. Is it not possible with "out of the box MinGW" (I.e. not > rebuilding libgcc) to create applications that use shared libraries > with threads and exceptions? > There is local patchset in mingw version of gcc 3.4.2 that was supposed to allow thread-safe eh-unwinding across dll boundaries. It usually works. I think you may have hit a case of a global varable (in libsupc++/eh_globals.cc) that was missed (ie, not shared across dll and exe) up until gcc 3.4.4 or 3.4.5. The gcc-3.4.5 candidate on the SF download site may solve your problem. Unfortunately, adding the missing shared pointers make gcc-3.4.5 incompatible with gcc-3.4.2 so everything will need to be rebuilt. The real solution is to put the eh-unwind code in libgcc into libgcc_s.dll and to build libstdc++ as a dll too. Danny ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ MinGW-users mailing list MinGW-users@... You may change your MinGW Account Options or unsubscribe at: https://lists.sourceforge.net/lists/listinfo/mingw-users |
|
|