RE: arm-wince-pe global constructors/ Qt (was Re: arm-wince-pe)
[email protected] Tue, 23 Aug 2005 00:36:09 +0100
| Newsgroups | gmane.comp.windows.ce.freeware |
|---|---|
| Message-ID | <[email protected]> |
Hi again, <warning> long email. </warning> Citando "Keuchel, Rainer" <keuchel-ypdxL0zNX99Wk0Htik3J/[email protected]>: > I think for making ctors in dlls work one has to add special > init sections in the binary by modifying binutils, > but the order in which static ctors are called when > using multiple dlls is kind of undefined, so they must not > depend on each other. Qt already builds as a dll on Mingw perfectly out of the box, so I hope that most of the work should be done. > When you could provide some sample for reproducing your > problems I might take a look. Here is a minimum test case for the uncalled global constructors with arm-wince-pe from Mamaich's website case. I really don't know if this is solved in more recent versions of gcc. I've heard that gcc from mainline is quite broken for wince target, so I have not tried it yet. --------------------- case 1: arm-wince-pe-g++ glob_cons_test.cpp -o test_ccs.exe fire gdb on it, type run. case 2: arm-wince-pe-g++ glob_cons_test.cpp -o test_ccs.exe -staticlibs <cut here> #include <windows.h> struct test_ccs { test_ccs() : a(20) {} int a; }; // test data static test_ccs glob_static; test_ccs glob_extern; int int_data = 20; int int_bss; // should print out zero if bss is being correcly initialized to zero extern "C" void __gccmain(); void my_out_var(const WCHAR* pre, int num) { WCHAR buf[300]; wsprintf(buf, L"%s = %d (0x%x)\n", pre, num, num); OutputDebugStringW(buf); } #define OUT_VAR(X) my_out_var(TEXT(#X), X) int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR /*wCmdParam*/, int cmdShow) { // uncomment this to make global constructor work without -staticlibs // __gccmain(); OutputDebugStringW(L"HELLO\n"); static test_ccs func_static; OUT_VAR(int_data); OUT_VAR(int_bss); OUT_VAR(glob_extern.a); OUT_VAR(glob_static.a); OUT_VAR(func_static.a); return 0; } </cut here> -------------------- case 1 results: $ gdb test_ccs.exe GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i686-pc-cygwin --target=arm-wince-pe"... (no debugging symbols found)... (gdb) run Starting program: /cygdrive/d/Qt/4.0.0-mingw/examples/qpe/test_ccs.exe Starting on device: "\gdb\wince-stub.exe \gdb\wince-stub.exe" Waiting for connection... d81000:libc.dll 3081000:iphlpapi.dll 3061000:ws2.dll 3071000:winsock.dll 7ffe1000:coredll.dll.0409.mui 1f61000:coredll.dll warning: HELLO warning: int_data = 20 (0x14) warning: int_bss = 0 (0x0) warning: glob_extern.a = 0 (0x0) warning: glob_static.a = 0 (0x0) warning: func_static.a = 20 (0x14) Program exited normally. (gdb) case 2 results: $ gdb test_ccs.exe GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i686-pc-cygwin --target=arm-wince-pe"... (no debugging symbols found)... (gdb) run Starting program: /cygdrive/d/Qt/4.0.0-mingw/examples/qpe/test_ccs.exe Starting on device: "\gdb\wince-stub.exe \gdb\wince-stub.exe" Waiting for connection... 3061000:ws2.dll 3071000:winsock.dll 7ffe1000:coredll.dll.0409.mui 1f61000:coredll.dll warning: HELLO warning: int_data = 20 (0x14) warning: int_bss = 0 (0x0) warning: glob_extern.a = 20 (0x14) warning: glob_static.a = 20 (0x14) warning: func_static.a = 20 (0x14) Program exited normally. ----------- on both cases, we can see that both bss and data are correctly initialized, and also function statics contructors are being called. on the first case however, glob_extern.a and glob_static.a print 0. this means global constructors are not being called. I've postponed this problem until latter. For the interested, I have ported minesweeper from qtopia to Qt4 wince, and it works almost glitchless! I must say I am really excited about this! I am now trying to set window styles correctly, and wondering what should I do with the sip and the menubar. Pedro Alves __________________________________________________________ Pare de esbanjar dinheiro! Compare o preço da sua ligação à Internet http://acesso.portugalmail.pt/maisbarato ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h7c7745/M=362329.6886308.7839368.1510227/D=groups/S=1707281942:TM/Y=YAHOO/EXP=1124760974/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 ">Fair play? Video games influencing politics. Click and talk back!</a>.</font> --------------------------------------------------------------------~->