mingw build failure: undefined reference to `WinMain@16' in windbgdlg.cpp

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: Mook, Assigned: Mook)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

windbgdlg now uses wWinMain, which mingw doesn't understand.  Ugly patch (mingw only) coming up.  Also deals with the fact that for mingw, __argc / __argv are uninitialized.

Asking r? based on who touched it last, hopefully that's okay :)
Attachment #355322 - Flags: review?(neil)
Comment on attachment 355322 [details] [diff] [review]
mingw only, make a stub WinMain

>+#include <shellapi.h>
Does this need OS_LIBS += $(call EXPAND_LIBNAME, shell32) in the Makefile?

>+int wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int);
WINAPI. See the definition! WinMain also needs to be WINAPI for r=me

>+  while (*commandLine <= L' ') {
>+    ++commandLine;
>+  }
>+  if (L'"' == *commandLine) {
I think this just looks inconsistent. *commandLine on the left please?

>+    ++commandLine;
>+    while ((L'"' != *commandLine) && *commandLine) {
Again you inconsistently null-check this loop but not the other two loops.
(Also && is well known to be lower precedence than !=)

>+    if (L'"' == *commandLine) {
>+      ++commandLine;
>+    }
There is a way of writing this to avoid the double test but I'm not fussed.

>+    while (*commandLine > L' ') {
>+      ++commandLine;
>+    }
[This loop does not of course need a null-check]
Attachment #355322 - Flags: review?(neil) → review+
(In reply to comment #1)
> (From update of attachment 355322 [details] [diff] [review])
> >+#include <shellapi.h>
> Does this need OS_LIBS += $(call EXPAND_LIBNAME, shell32) in the Makefile?
Hmm, didn't seem to need it (and things worked fine; I'm using mingw-w64 HEAD though, dunno if that has weird scary patches).

> >+int wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int);
> WINAPI. See the definition! WinMain also needs to be WINAPI for r=me
Ugh.  Sorry, that was just stupid of me :(  Added to both.

> >+  while (*commandLine <= L' ') {
> >+    ++commandLine;
> >+  }
> >+  if (L'"' == *commandLine) {
> I think this just looks inconsistent. *commandLine on the left please?
Moved it all to the left.

> >+    ++commandLine;
> >+    while ((L'"' != *commandLine) && *commandLine) {
> Again you inconsistently null-check this loop but not the other two loops.
> (Also && is well known to be lower precedence than !=)
And added null checking in all cases except the > ' ' case mentioned below.
The () remains to be explicit.

> >+    if (L'"' == *commandLine) {
> >+      ++commandLine;
> >+    }
> There is a way of writing this to avoid the double test but I'm not fussed.
Made it just check for non-null instead, because to get out of the while loop immediately above it needs to be either a quote (which is not null) or a null.

> >+    while (*commandLine > L' ') {
> >+      ++commandLine;
> >+    }
> [This loop does not of course need a null-check]

Carrying forward r+.
Asking bsmedberg for sr.  Asking for sr at all partly because that patch in retrospect looked embarrassingly bad :(  (see bug bug 411826 for some vaguely related information on mingw lacking wmain, for example)
Assignee: nobody → mook.moz+mozbz
Attachment #355322 - Attachment is obsolete: true
Attachment #355367 - Flags: superreview?(benjamin)
Attachment #355367 - Flags: review+
Attachment #355367 - Flags: superreview?(benjamin) → superreview+
Marking as checkin-needed; IIRC the tree (m-c only) doesn't need anything else at the moment.  Not looking to land on any branches.
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/cfcb51bdb852
Status: NEW → RESOLVED
Closed: 11 years ago
Keywords: checkin-needed
OS: Linux → Windows 2000
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.