Hi,
I am new to Winelib and I have crashes with very basic C++ code. Consider the following code:
#include <windows.h>
struct MyInit {
MyInit() {
OutputDebugStringA("Init ctor\n");
}
};
MyInit InitObj;
extern "C" int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
OutputDebugStringA("WinMain()\n");
return 0;
}
If I compile it on Ubuntu 32-bit with wine-1.6.2 with:
wineg++ -c -mno-cygwin -o hello.o hello.cpp
wineg++ -mwindows -mno-cygwin -o hellocpp.exe hello.o
The result is:
$ ./hellocpp.exe
Segmentation fault (core dumped)
On Windows this program obviously outputs "Init ctor\n" followed by "WinMain()\n", as viewed in DbgView. Removing the call to OutputDebugStringA from the static constructor prevents the crash in Winelib.
How do I get C++ static initialization to work properly in Winelib?
Thanks,
Luke