Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
LibraryBackend.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** R-Type
4** File description:
5** LibraryBackend.hpp, declarations for platform-specific dynamic
6** library handling
7*/
8
9/*
10** MIT License
11**
12** Copyright (c) 2025 Robin Toillon
13**
14** Permission is hereby granted, free of charge, to any person obtaining
15** a copy of this software and associated documentation files (the
16** "Software"), to deal in the Software without restriction, including
17** without limitation the rights to use, copy, modify, merge, publish,
18** distribute, sublicense, and/or sell copies of the Software, and to
19** permit persons to whom the Software is furnished to do so, subject to
20** the following conditions:
21**
22** The above copyright notice and this permission notice shall be
23** included in all copies or substantial portions of the Software.
24**
25** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32*/
33
43#ifndef RTYPE_LIBRARYBACKEND_HPP_
44 #define RTYPE_LIBRARYBACKEND_HPP_
45
46 #include <expected>
47 #include <string>
48 #include <string_view>
49
50 #include "LibraryBackend.hpp"
51
53{
63 class LibraryBackend final {
64 public:
70 [[nodiscard]]
71 static auto open(std::string_view path)
72 -> std::expected<void *, rtp::Error>;
73
79 [[nodiscard]]
80 static auto close(void *handle) noexcept
81 -> std::expected<void, rtp::Error>;
82
89 [[nodiscard]]
90 static auto getSymbol(void *handle, std::string_view name)
91 -> std::expected<void *, rtp::Error>;
92 };
93}
94
95#endif /* !RTYPE_LibraryBackend_HPP_ */
Declarations for platform-specific dynamic library handling.
Provides platform-specific implementations for dynamic library operations.
static auto getSymbol(void *handle, std::string_view name) -> std::expected< void *, rtp::Error >
Get a symbol from the dynamic library.
static auto open(std::string_view path) -> std::expected< void *, rtp::Error >
Open a dynamic library from the given path.
static auto close(void *handle) noexcept -> std::expected< void, rtp::Error >
Close the dynamic library handle.