Preferred alternative fix (instead of CL16332153) for UE-115783 and UE-115714 that uses inlining instead of relying on the caller to selectively enable/disable linking in their build files. This leaves the TextureFormat module with zero exports. Only interfaces and two inline functions. Confirmed compile & link on: win64 editor, win64 server shipping, linux server shipping, ShooterGame linux editor

#rb
#preflight 609eecbbf6c6e3000143e139

[CL 16337324 by Zousar Shaker in ue5-main branch]
This commit is contained in:
Zousar Shaker
2021-05-14 18:38:25 -04:00
parent a055d11fa5
commit ed9e510483
3 changed files with 15 additions and 20 deletions

View File

@@ -6,7 +6,20 @@
#include "Interfaces/ITextureFormatManagerModule.h"
/** Return the Texture Format Manager interface, if it is available, otherwise return nullptr. **/
TEXTUREFORMAT_API class ITextureFormatManagerModule* GetTextureFormatManager();
inline ITextureFormatManagerModule* GetTextureFormatManager()
{
return FModuleManager::LoadModulePtr<ITextureFormatManagerModule>("TextureFormat");
}
/** Return the Texture Format Manager interface, fatal error if it is not available. **/
TEXTUREFORMAT_API class ITextureFormatManagerModule& GetTextureFormatManagerRef();
inline ITextureFormatManagerModule& GetTextureFormatManagerRef()
{
class ITextureFormatManagerModule* TextureFormatManager = GetTextureFormatManager();
if (!TextureFormatManager)
{
UE_LOG(LogInit, Fatal, TEXT("Texture format manager was requested, but not available."));
CA_ASSUME( TextureFormatManager != NULL ); // Suppress static analysis warning in unreachable code (fatal error)
}
return *TextureFormatManager;
}