From: Brendon Costa <bcosta@av...> - 2007-05-07 04:42:22
I have been using MinGW for a while now, mostly with static libraries
and in the past everything has worked fine.
I have a situation now where i have a main executable, that links
statically with a particular library. This static library makes use of
code from another library which is a DLL. So when i link the main
application i also link with the static library and the DLL's link-lib.
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?
Note: I am using g++ version: 3.4.2 (mingw-special)
To verify the problem i rebuilt the DLL as a static library and and
linked with that instead and all worked fine.
Does anyone have any ideas or suggestions how i can still make use of
the DLL in this situation or do I have to force the use of static