Open Bug 492307 Opened 16 years ago Updated 2 years ago

Unresolved external symbol main

Categories

(NSPR :: NSPR, defect)

ARM
Windows CE
defect

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: hiro, Assigned: hiro)

Details

(Keywords: mobile)

Attachments

(1 file, 1 obsolete file)

/c/cygwin/home/user/hg/mozilla-central/objdir-wm6-test/xulrunner/dist/sdk/bin/ar m-wince-gcc -Fowince_tester.obj -c -Zi -UNDEBUG -DDEBUG_user -DMOZILLA_C LIENT=1 -DDEBUG=1 -DXP_PC=1 -DWIN32=1 -DWINCE=1 -D_PR_GLOBAL_THREADS_ONLY=1 -DF ORCE_PR_LOG -I/c/cygwin/home/user/hg/mozilla-central/objdir-wm6-test/xulrunner/d ist/include/nspr -I/c/cygwin/home/user/hg/mozilla-central/nsprpub/pr/include -I/ c/cygwin/home/user/hg/mozilla-central/nsprpub/pr/include/private -FInst_wince.h /c/cygwin/home/user/hg/mozilla-central/nsprpub/pr/tests/wince_tester.cpp Microsoft (R) C/C++ Optimizing Compiler Version 15.00.20720 for ARM Copyright (C) Microsoft Corporation. All rights reserved. wince_tester.cpp /c/cygwin/home/user/hg/mozilla-central/objdir-wm6-test/xulrunner/dist/sdk/bin/ar m-wince-link wince_tester.obj -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO -PDB :wince_tester.pdb -SUBSYSTEM:CONSOLE /c/cygwin/home/user/hg/mozilla-central/objd ir-wm6-test/xulrunner/dist/lib/plc4.lib /c/cygwin/home/user/hg/mozilla-central/o bjdir-wm6-test/xulrunner/dist/lib/nspr4.lib ws2.lib coredll.lib -OUT:wince_teste r.exe Creating library wince_tester.lib and object wince_tester.exp ARMV4I : error LNK2001: unresolved external symbol main wince_tester.exe : fatal error LNK1120: 1 unresolved externals make: *** [wince_tester.exe] Error 96 make: Leaving directory `/c/cygwin/home/user/hg/mozilla-central/objdir-wm6-test/ xulrunner/nsprpub/pr/tests' ~
The reason of this error is that -FInst_wince.h option is also set for wince_tester.cpp, so main function is defined as "nspr_test_runme".
Attached patch Proposed patch (obsolete) — Splinter Review
Implement wmain instead of main and set -ENTRY:mainWCRTStartup to EXE_EXTRA_LD_OPTS instead of -SYSTEM:CONSOLE. To do #undef main in wince_tester.cpp can link correctly but argc and argv can not be obtained correctly. I know argv is not used main function but it shoud be fixed for the safety of feature development.
Attachment #376658 - Flags: review?(wtc)
(In reply to comment #2) > I know argv is not used main function but it shoud be fixed for the safety of > feature development. I meant future development.
As the other co-owner of NSPR, I see every contribution, every bug comment for every NSPR bug. There is no one subject that is more frequently contested than the name of the main function on WinCE. Half the patches want to get rid of main and switch to wmain, and the other half are going in the opposite direction. I want to see this tug-of-war stop. Let's settle, once and for all, the right way to have "main" functions in non-GUI (windowless) programs on WinCE. Doug, Brad, are you seeing this problem? If not, then I wonder why Hiroyuki is and you're not.
(In reply to comment #4) > Doug, Brad, are you seeing this problem? > If not, then I wonder why Hiroyuki is and you're not. I guess they do not make tests.
After I thought about some more, I'd propose to create a c source including wmain function and set -FI option with the c source and remove DllMain from nst_wince.h. This is the almost same proposal that was suggested by Brad in bug 491994.
If we take this approach, each test source was make as each execution file, so we do not need to maintain test_module_list in wince_tester.cpp whenever we add a new source and remove it. Actually parsetm is not listed in test_module_list.
(In reply to comment #7) > If we take this approach, each test source was make as each execution file, so *is made* My brain.. baka.
(In reply to comment #4) > Doug, Brad, are you seeing this problem? > If not, then I wonder why Hiroyuki is and you're not. I've been building with tests disabled, so I haven't been seeing it but I know it exists and I promised Joel to look into it once we get alpha 1 for windows mobile out the door. I know Benjamin has some opinions on the subject of entry points, so I'm adding him to the CC.
Assignee: wtc → nspr
Comment on attachment 376658 [details] [diff] [review] Proposed patch Hiroyuki, thanks for working on this bug. I'm not the right person to review patches for this bug. Nelson and the Mozilla Fennec team (on the cc list) can help you.
Attachment #376658 - Flags: review?(wtc)
This patch is fulfilled the thing I commented in comment #6. * rename nst_wince.h to nst_wince.c * remove DllMain from nst_wince.c * implement wmain function in nst_wince.c * include nst_wince.c instead of nst_wince with -FI option * add -ENTRY:mainWCRTStartup option This patch works fine on Windows Emulator. A piece of test program can be run easier than a big test runner program (i.e. current test program for WinCE), so I prefer this approach. Benjamin, please tell me what you think about this issue.
Assignee: nspr → ikezoe
Attachment #376658 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: