Closed Bug 405256 Opened 17 years ago Closed 16 years ago

Compile error in nsNativeDragTarget.h with MingW GCC because of missing shobjidl.h

Categories

(Core :: Widget: Win32, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9beta5

People

(Reporter: jfwfreo, Assigned: bengt.erik.soderstrom)

References

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071030 SeaMonkey/1.1.6
Build Identifier: 

MingW does not include shobjidl.h which prevents nsNativeDragTarget.h from compiling. Fix is to not #include shobjidl.h on MingW GCC (doing so allows compilation to succeed)


Reproducible: Always
Attached patch possible patch (obsolete) — Splinter Review
Possible patch.
Attachment #290056 - Flags: superreview?(roc)
Attachment #290056 - Flags: review?(vladimir)
Is this patch the correct solution or is there a better way (e.g. getting a shobjidl.h into MingW)?
Getting shobjidl.h into MingW would be good but until then we should fix our code.

 //MingW does not provide shobjidl.h. Code compiles fine without it however

Why don't we just remove it altogether then? Is it because you're not building on Vista? What if someone tries to do a MingW build on Vista?
VC8 and MingW both define IDropTargetHelper in shlobj.h. The Microsoft SDK I have installed (which labels itself v6.0) moves it to shobjidl.h. Ergo, even if you built on Vista with all the WINVER settings to make that happen, it would still build just fine with VC8 and MingW.

The question is, given that shlobj.h on MingW provides IDropTargetHelper, why is it still trying to #include shobjidl.h? Is _WIN32_IE not being defined properly?
I don't know, you'll have to find out. I'd try using -E to preprocess the source to see what's getting defined. 
Blocks: mingw
> The question is, given that shlobj.h on MingW provides IDropTargetHelper, why
is it still trying to #include shobjidl.h?
Because IDropTargetHelper isn't #defined in preprocessor but declared in c code. And that is why it's not visible to preprocessor #ifdef. Preprocessor knows nothing about c/c++.

It's stupid to check for c/c++ declaration using preprocessor condition:
nsNativeDragTarget.h:45:
#ifndef IDropTargetHelper

Preprocessor sees only declarations from earlier #defines and -D command line options.

That is why even after #include <shobjidl.h> "#ifndef IDropTargetHelper" will still succeed.

DECLARE_INTERFACE_(IDropTargetHelper, IUnknown) after preprocessing will become:

struct __attribute__((com_interface)) IDropTargetHelper : public IUnknown

and again IDropTargetHelper will be not visible to preprocessor.

Certainly this is error.
Attachment #290056 - Attachment is obsolete: true
Attachment #306468 - Flags: superreview?
Attachment #306468 - Flags: review?
Attachment #290056 - Flags: superreview?(roc)
Attachment #290056 - Flags: review?(vladimir)
About a week ago, in bug 418658, a similar fix regarding WinCE was checked in.
If that could be done, I then think also letting MinGW exclude shobjidl.h should be allowed.

Changing the status to NEW and attach a new possible patch
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #306468 - Flags: superreview?
Attachment #306468 - Flags: review?(benjamin)
Attachment #306468 - Flags: review?
Blocks: 421095
Attachment #306468 - Flags: review?(benjamin)
Attachment #306468 - Flags: review+
Attachment #306468 - Flags: approval1.9?
Comment on attachment 306468 [details] [diff] [review]
Possible patch ver 2

a1.9+=damons
Attachment #306468 - Flags: approval1.9? → approval1.9+
Assignee: nobody → bengt.erik.soderstrom
Keywords: checkin-needed
Version: unspecified → Trunk
I am not authorized to make cvs check-ins, perhaps someone else can help?
Benjamin? Martijn?
Reed is normally pretty quick when the bug has the "checkin-needed" keyword (thanks Reed!). Otherwise I can check this in tonight. 
Checking in widget/src/windows/nsNativeDragTarget.h;
/cvsroot/mozilla/widget/src/windows/nsNativeDragTarget.h,v  <--  nsNativeDragTarget.h
new revision: 1.15; previous revision: 1.14
done
Status: NEW → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9beta5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: