Skip to content

[GEN][ZH] Fix COM related compile errors for MinGW #672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ library BROWSERDISPATCHLib
]
interface IBrowserDispatch : IUnknown
{
[id(1), helpstring("method TestMethod")] HRESULT TestMethod(Int num1);
[id(1), helpstring("method TestMethod")] HRESULT TestMethod(int num1);
};
};
3 changes: 3 additions & 0 deletions Core/Libraries/Source/EABrowserEngine/BrowserEngine.idl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
//
// typelib filename: <could not determine filename>

// NOTE: Import of oaidl.idl has been added to fix compilation error with widl:
// BrowserEngine.idl:31:44: error: type 'IDispatch' not found in global namespace
import "oaidl.idl";
[
uuid(6EE45698-21BA-420D-AD40-1B547699BEFB),
version(1.0)
Expand Down
7 changes: 7 additions & 0 deletions Dependencies/Utility/Utility/CppMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
#define NOEXCEPT_17
#endif

// noexcept for methods of IUNKNOWN interface
#if defined(_MSC_VER)
#define IUNKNOWN_NOEXCEPT NOEXCEPT_17
#else
#define IUNKNOWN_NOEXCEPT
#endif

#if __cplusplus >= 201103L
#define CPP_11(code) code
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ class WebBrowser :
// IUnknown methods
//---------------------------------------------------------------------------
protected:
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) NOEXCEPT_17;
ULONG STDMETHODCALLTYPE AddRef(void) NOEXCEPT_17;
ULONG STDMETHODCALLTYPE Release(void) NOEXCEPT_17;
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) IUNKNOWN_NOEXCEPT;
ULONG STDMETHODCALLTYPE AddRef(void) IUNKNOWN_NOEXCEPT;
ULONG STDMETHODCALLTYPE Release(void) IUNKNOWN_NOEXCEPT;

//---------------------------------------------------------------------------
// IBrowserDispatch methods
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Source/Common/GameEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ GameEngine::GameEngine( void )
m_quitting = FALSE;
m_isActive = FALSE;

_Module.Init(NULL, ApplicationHInstance);
_Module.Init(NULL, ApplicationHInstance, NULL);
}

//-------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ WebBrowserURL * WebBrowser::makeNewURL(AsciiString tag)
*
******************************************************************************/

STDMETHODIMP WebBrowser::QueryInterface(REFIID iid, void** ppv) NOEXCEPT_17
STDMETHODIMP WebBrowser::QueryInterface(REFIID iid, void** ppv) IUNKNOWN_NOEXCEPT
{
*ppv = NULL;

Expand Down Expand Up @@ -270,7 +270,7 @@ STDMETHODIMP WebBrowser::QueryInterface(REFIID iid, void** ppv) NOEXCEPT_17
*
******************************************************************************/

ULONG STDMETHODCALLTYPE WebBrowser::AddRef(void) NOEXCEPT_17
ULONG STDMETHODCALLTYPE WebBrowser::AddRef(void) IUNKNOWN_NOEXCEPT
{
return ++mRefCount;
}
Expand All @@ -290,7 +290,7 @@ ULONG STDMETHODCALLTYPE WebBrowser::AddRef(void) NOEXCEPT_17
*
******************************************************************************/

ULONG STDMETHODCALLTYPE WebBrowser::Release(void) NOEXCEPT_17
ULONG STDMETHODCALLTYPE WebBrowser::Release(void) IUNKNOWN_NOEXCEPT
{
DEBUG_ASSERTCRASH(mRefCount > 0, ("Negative reference count"));
--mRefCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ Bool W3DWebBrowser::createBrowserWindow(const char *tag, GameWindow *win)
return FALSE;
}

#ifdef __GNUC__
CComQIIDPtr<I_ID(IDispatch)> idisp(m_dispatch);
#else
CComQIPtr<IDispatch> idisp(m_dispatch);
#endif
if (m_dispatch == NULL)
{
return FALSE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ class WebBrowser :
// IUnknown methods
//---------------------------------------------------------------------------
protected:
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) NOEXCEPT_17;
ULONG STDMETHODCALLTYPE AddRef(void) NOEXCEPT_17;
ULONG STDMETHODCALLTYPE Release(void) NOEXCEPT_17;
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) IUNKNOWN_NOEXCEPT;
ULONG STDMETHODCALLTYPE AddRef(void) IUNKNOWN_NOEXCEPT;
ULONG STDMETHODCALLTYPE Release(void) IUNKNOWN_NOEXCEPT;

//---------------------------------------------------------------------------
// IBrowserDispatch methods
Expand Down
2 changes: 1 addition & 1 deletion GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ GameEngine::GameEngine( void )
m_quitting = FALSE;
m_isActive = FALSE;

_Module.Init(NULL, ApplicationHInstance);
_Module.Init(NULL, ApplicationHInstance, NULL);
}

//-------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ WebBrowserURL * WebBrowser::makeNewURL(AsciiString tag)
*
******************************************************************************/

STDMETHODIMP WebBrowser::QueryInterface(REFIID iid, void** ppv) NOEXCEPT_17
STDMETHODIMP WebBrowser::QueryInterface(REFIID iid, void** ppv) IUNKNOWN_NOEXCEPT
{
*ppv = NULL;

Expand Down Expand Up @@ -270,7 +270,7 @@ STDMETHODIMP WebBrowser::QueryInterface(REFIID iid, void** ppv) NOEXCEPT_17
*
******************************************************************************/

ULONG STDMETHODCALLTYPE WebBrowser::AddRef(void) NOEXCEPT_17
ULONG STDMETHODCALLTYPE WebBrowser::AddRef(void) IUNKNOWN_NOEXCEPT
{
return ++mRefCount;
}
Expand All @@ -290,7 +290,7 @@ ULONG STDMETHODCALLTYPE WebBrowser::AddRef(void) NOEXCEPT_17
*
******************************************************************************/

ULONG STDMETHODCALLTYPE WebBrowser::Release(void) NOEXCEPT_17
ULONG STDMETHODCALLTYPE WebBrowser::Release(void) IUNKNOWN_NOEXCEPT
{
DEBUG_ASSERTCRASH(mRefCount > 0, ("Negative reference count"));
--mRefCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ Bool W3DWebBrowser::createBrowserWindow(const char *tag, GameWindow *win)
return FALSE;
}

#ifdef __GNUC__
CComQIIDPtr<I_ID(IDispatch)> idisp(m_dispatch);
#else
CComQIPtr<IDispatch> idisp(m_dispatch);
#endif
if (m_dispatch == NULL)
{
return FALSE;
Expand Down