MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Dll.h
Go to the documentation of this file.
1/** @noop License Comment
2 * @file
3 * @copyright
4 * This Source Code is subject to the terms of the Mozilla Public License, v2.0.
5 * If a copy of the MPL was not distributed with this file You can obtain one at
6 * https://mozilla.org/MPL/2.0/
7 *
8 * @author David Mórász
9 * @date 2025
10 */
11
12#pragma once
13
14#include "CoreMinimal.h"
15#include "Mcro/Concepts.h"
16
17namespace Mcro::Dll
18{
19 using namespace Mcro::Concepts;
20
21 /** RAII wrapper around PushDllDirectory / PopDllDirectory */
22 struct MCRO_API FScopedSearchPath
23 {
24 FScopedSearchPath(FString const& path);
26
27 private:
28 FString Path;
29 };
30
31 /** RAII wrapper around GetDllHandle / FreeDllHandle */
32 struct MCRO_API FScopedDll
33 {
34 FScopedDll(const TCHAR* fileName);
36
37 private:
38 void* Handle;
39 };
40
41 /** Handle multiple DLL files in one set and an optional base path for them */
42 struct MCRO_API FScopedDllSet
43 {
45
46 template <CConvertibleTo<const TCHAR*>... Args>
47 FScopedDllSet(FString const& pushPath, Args... args)
48 {
49 FScopedSearchPath pathContext(pushPath);
50 (Dlls.Emplace(args), ...);
51 }
52
53 private:
54
55 TArray<FScopedDll> Dlls;
56 };
57}
FScopedDllSet(FString const &pushPath, Args... args)
Definition Dll.h:47
FScopedDll(const TCHAR *fileName)
FScopedSearchPath(FString const &path)