Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
dynamic-library.h
1
// SPDX-License-Identifier: MIT
2
// SPDX-FileCopyrightText: 2025-2026 Manuel Osorio
3
#pragma once
4
5
#include "flint/core/api.h"
6
7
#include <filesystem>
8
9
namespace
Flint {
10
class
DynamicLibrary
{
11
public
:
12
DynamicLibrary
() =
default
;
13
FLINT_API
~DynamicLibrary
();
14
15
DynamicLibrary
(
const
DynamicLibrary
&) =
delete
;
16
DynamicLibrary
&operator=(
const
DynamicLibrary
&) =
delete
;
17
18
FLINT_API
DynamicLibrary
(
DynamicLibrary
&&other)
noexcept
;
19
FLINT_API
DynamicLibrary
&operator=(
DynamicLibrary
&&other)
noexcept
;
20
21
FLINT_API
bool
load(
const
std::filesystem::path &path);
22
FLINT_API
bool
tryLoad(
const
std::filesystem::path &path);
23
FLINT_API
void
unload();
24
25
template
<
typename
T>
26
T getSymbol(
const
char
*name)
const
{
27
return
reinterpret_cast<
T
>
(getSymbolAddress(name));
28
}
29
30
[[nodiscard]] FLINT_API
bool
isLoaded()
const
;
31
32
private
:
33
bool
loadImpl(
const
std::filesystem::path &path,
bool
logFailure);
34
FLINT_API
void
*getSymbolAddress(
const
char
*name)
const
;
35
36
void
*m_handle =
nullptr
;
37
};
38
}
Flint::DynamicLibrary
Definition
dynamic-library.h:10
include
flint
platform
dynamic-library.h
Generated by
1.12.0