Compiling PlayFabs Multiplayer SDK's with CLANG

The post discusses an issue that developers might encounter when using the PlayFab Multiplayer SDK with Unreal Engine and cross-compiling on different platforms such as Windows and Android.


When working with PlayFab, you might encounter the new Multiplayer SDK that is used to implement PlayFab Party and the new Lobby service into you game. If you are using Unreal Engine and want to cross compile your solution on Windows / Android and others, you might notice that this requires different compliers from MSVC like CLANG. The problem now is that just including the SDK’s and libs won’t compile in UE for all your desired platforms. In this post we will focus on why that is and how to fix it.

Help, I get a bunch of compiler errors

A sample compiler error you might encounter would be like this:

error: '__stdcall' calling convention is not supported for this target

But why are you getting this error? The short answer is that when compiling with CLANG you are missing SAL Annotations which describes it as following:

Natively, C and C++ provide only limited ways for developers to consistently express intent and invariance. By using SAL annotations, you can describe your functions in greater detail so that developers who are consuming them can better understand how to use them.

But I need to compile with CLANG

You might say that this is awesome in theory but does not help you with your problem and you are right, but I think it’s important to understand your problem, so you understand the solution instead of just copying the conclusion of this article. PlayFab is designed as cross platform tool and had these problems in mind when it was developed and has a straight forward solution for you.

To solve this problem, you need to define the missing types that would be provided by the SAL annotation like this:

#ifndef __stdcall
#define __stdcall
#endif

Luckily PlayFab already did that work for us by providing a Header file that you just need to include in your program.

#include "PartyPal.h"

Conclusion

As we have seen, PlayFab is cross platform capable if you understand that different platforms have different features like MSVC and CLANG. But with the right header this can be resolved quickly.