x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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!

Product Version: UE 4.15
Tags:
more ▼

asked Mar 03 '17 at 01:09 PM in C++ Programming

avatar image

druidsbane
187 11 21 171

avatar image duke22 Mar 17 '17 at 04:54 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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

more ▼

answered Mar 21 '17 at 02:29 AM

avatar image

duke22
180 11 15 29

avatar image druidsbane Mar 21 '17 at 02:48 AM

Thanks! Will try and report back!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Mar 17 '17 at 03:59 PM

avatar image

Jo_PkFX
49 3 5 13

avatar image druidsbane Mar 21 '17 at 02:50 AM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question