Hi -
I had a wine crash today that occurs before wine is properly initialized, and therefore was pretty nasty to debug. However I traced it down to the test program below.
The test program is loaded as a winelib app (i.e. a dll).
The program defines a global variable that is an instance of a class where the constructor calls InitalizeCriticalSection(). Interestingly, the call to RtlInitializeCriticalSection() completes successfully, but subsequently the program crashes and the stack is corrupted, so that I can't really see where the program is stuck. It seems that the dlopen() call in wine_dlopen() on Test.so never finishes, though.
This seems to run fine on windows. Comments?
Martin
#include <winbase.h> #include <stdio.h>
class cs_test;
class cs_test { public: CRITICAL_SECTION crit; cs_test(); ~cs_test() {}; };
cs_test::cs_test() { memset ( &(this->crit), 0, sizeof (CRITICAL_SECTION) ); InitializeCriticalSection ( &(this->crit) ); };
// this statement causes the crash when called at DLL load time cs_test tst;
int main() { return 0; }
I hate to shout around, but I really need advice with this one. Thanks, Martin
"Martin" == Martin Wilck Martin.Wilck@Fujitsu-Siemens.com writes:
Martin> I hate to shout around, but I really need advice with this one. Martin> Thanks, Martin
Some comments, probably of not too jmuch help:
For a long time, winelib was known not to work with c++, as the initialization was a problem. I thought that problem was solved however. Read the archive to find out more about that.
Other hints: - What does a debuglog tell about the crash? - Does the programm run compiled a windows executable? - Check you C++ compiler
Bye
Am Mit, 2002-05-22 um 10.38 schrieb Uwe Bonnes:
For a long time, winelib was known not to work with c++, as the initialization was a problem. I thought that problem was solved however. Read the archive to find out more about that.
I found the hint that winemaker must be called with --wrap to work around it. My problem is that winemaker seems to be broken after the latest changes to winebuild. I have not figured out yet how to link the wrapper application without getting unresolved symbols.
I wonder if anybody works on adapting winemaker to the latest changes - I'd do it but my knowledge on wine linking issues is somewhat limited.
Other hints:
- What does a debuglog tell about the crash?
Very little. I have had most success by debugging wine directly in gdb. However the crash happens during the dlopen() call, and it is really hard to follow the CPU jumping wildly around through jump tables. I have put TRACE's in InitializeCriticalSection and found that the routine finishes successfully. The problem occurs when returning from the routine.
Thanks, Martin