<div dir="ltr">Hi,<div><br></div><div>I am new to Winelib and I have crashes with very basic C++ code. Consider the following code:</div><div><br></div><div><br></div><div><div>#include <windows.h></div><div><br></div><div>struct MyInit {</div><div>        MyInit() {</div><div><span class="Apple-tab-span" style="white-space:pre">             </span>OutputDebugStringA("Init ctor\n");</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div>};</div><div>MyInit InitObj;<br></div><div><br></div><div>extern "C" int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)</div><div>{<br></div><div><span class="Apple-tab-span" style="white-space:pre">   </span>OutputDebugStringA("WinMain()\n");</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>return 0;</div><div>}</div></div><div><br></div><div><br></div><div>If I compile it on Ubuntu 32-bit with wine-1.6.2 with:</div><div><br></div><div>wineg++ -c -mno-cygwin -o hello.o hello.cpp</div><div>wineg++ -mwindows -mno-cygwin -o hellocpp.exe hello.o</div><div><br></div><div>The result is:</div><div><br></div><div>$ ./hellocpp.exe</div><div>Segmentation fault (core dumped)</div><div><br></div><div>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.<br></div><div><br></div><div>How do I get C++ static initialization to work properly in Winelib?</div><div><br></div><div>Thanks,</div><div>Luke</div><div><br></div></div>