C++ Plugin Can No Longer reference some Win32 Methods Like GetObject in 4.15

Hi,

I have a project that has been working for a couple of years now but since the compilation changes in 4.15 I can no longer reference some Win32 calls like GetObject. I also get errors with DirectXMath.h related to InterlockedIncrement. This used to compile fine and now it seems that somehow _M_CEE is not being defined or its definition has changed and so some methods have been #undefined by the Win32 headers.

Is there a new process for referencing native methods and DX11 headers in 4.15 plugins? I’ve reinstalled visual studio, the windows developer sdk and checked to make sure my headers are using the allowwindowsplatform/hidewindowsplatform headers you guys have.

Thanks for your help!

I’m also running into the issue with InterlockedIncrement as of 4.15 when using TComPtr.

You can use GetObjectA (ANSI) or GetObjectW (Unicode): those are the true windows’ functions.

Windows’ GetObject is actually a define, and makes anything named GetObject (variable, member functions, etc…) fail to compile quite dramatically.

So people often #undef GetObject after #include "windows.h".

A lot of windows functions are like this, look a the very bottom of their documentation page.

And see Engine\Source\Runtime\Core\Public\Windows\PostWindowsApi.h for the #undef list.

Here is the actual windows.h code:

WINGDIAPI int   WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv);
WINGDIAPI int   WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv);
#ifdef UNICODE
#define GetObject  GetObjectW
#else
#define GetObject  GetObjectA
#endif // !UNICODE

And Here is about ANSI/Unicode.

The solution for me was to:
#include “AllowWindowsPlatformAtomics.h”

Thanks! Will try and report back!

Thanks, and while that does solve the GetObject problem. The InterlockedIncrement issue is still unsolved and less in my control. I think your solution coupled with duke22 is probably the way to go!