Hi Kevin, > A ".a" file is composed of a set of ".o" files. When linking with a > ".a" library, the linker will only pull in those ".o" files that > resolve an outstanding symbol. So, if the linker doesn't have WinMain > outstanding, it shouldn't try to pull in winmain_ce.o.
Many thanks for answering this. I had really started to assume that the compiler was doing something special to handle this WinMain(). But now is it clear that is not the case, I have be able to try a different path. Does it pull in the entire object file even if it just wants to resolve a symbol that is only a part of that file? And can other symbols in that file affect the resolution of other symbols later on? (See below.) > Odd. Out of curiousity, does the following work: > $ arm-wince-mingw32ce-gcc -o output.exe main.c libmylib.a > if not, how about: > $ arm-wince-mingw32ce-gcc -o output.exe libmylib.a main.c Neither worked. But I have narrowed down the code to the absolute minimum and it seems I was chasing the wrong thing. I shouldn't have been looking at the library nor the WinMain() function it contained, but instead what that WinMain() function contained. Here is the complete single file minimum test program that causes the same error: #include <windows.h> int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { return __argc; } When compiling: $ arm-wince-mingw32ce-gcc -o mytest.exe mytest.c [...]/arm-wince-mingw32ce/lib/libmingw32.a(winmain_ce.o): In function `WinMain': [...]/cegcc/src/mingw/winmain_ce.c:143: multiple definition of `WinMain' [...]/ccxFleEh.o:mytest.c:(.text+0x0): first defined here [...]/arm-wince-mingw32ce/lib/libmingw32.a(winmain_ce.o):winmain_ce.c:(.text+0x1e0): undefined reference to `main' collect2: ld returned 1 exit status (Am I supposed to be using '__argc' like this?) The linker appears to pull this variable in from winmain_ce.c, which also then also gives me the multiple WinMain() definition. -- Matt. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Cegcc-devel mailing list Cegcc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cegcc-devel