Files
UnrealEngineUWP/Engine/Source/Programs/Enterprise/Datasmith/DatasmithFacadeCSharp/Private/DatasmithFacadeDLL.cpp
Marc Audy 68150e0be7 Merge UE5/Release-Engine-Staging to UE5/Main @ 14611496
This represents UE4/Main @ 14594913

[CL 14612291 by Marc Audy in ue5-main branch]
2020-10-29 13:38:15 -04:00

34 lines
991 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
// Datasmith SDK.
#include "DatasmithExporterManager.h"
/**
* On Windows we can safely use DllMain callback to call FDatasmithExporterManager::Shutdown()however there are no safe alternative on Mac and Linux.
* We cannot use __attribute__((destructor)) as it is not guaranteed to be called before static variables being freed.
* On those platforms we must call FDatasmithFacade::Shutdown() manually on the C# side when the application shutdowns.
*/
#if PLATFORM_WINDOWS
// Begin Datasmith platform include gard.
#include "Windows/AllowWindowsPlatformTypes.h"
BOOL WINAPI DllMain(
HINSTANCE HinstDLL,
DWORD FdwReason,
LPVOID LpvReserved
)
{
if (FdwReason == DLL_PROCESS_DETACH)
{
// When a process is unloading the DLL, shut down the Datasmith exporter module.
FDatasmithExporterManager::Shutdown();
}
return TRUE;
}
// End Datasmith platform include guard.
#include "Windows/HideWindowsPlatformTypes.h"
#endif