plugify 1.2.8
Loading...
Searching...
No Matches
platform_ops.hpp
1#pragma once
2
3#include <memory>
4
5#include "plugify/load_flag.hpp"
6#include "plugify/mem_addr.hpp"
7#include "plugify/types.hpp"
8
9namespace plugify {
10 // Platform-specific operations interface
12 public:
13 virtual ~IPlatformOps() = default;
14
15 // Core operations
16 virtual Result<void*> LoadLibrary(const std::filesystem::path& path, LoadFlag flags) = 0;
17 virtual Result<void> UnloadLibrary(void* handle) = 0;
18 virtual Result<MemAddr> GetSymbol(void* handle, std::string_view name) = 0;
19 virtual Result<std::filesystem::path> GetLibraryPath(void* handle) = 0;
20
21 // Platform capabilities
22 [[nodiscard]] virtual bool SupportsRuntimePathModification() const = 0;
23 [[nodiscard]] virtual bool SupportsLazyBinding() const = 0;
24
25 // Search path management (if supported)
26 virtual Result<void> AddSearchPath([[maybe_unused]] const std::filesystem::path& path) {
27 return MakeError("Runtime path modification not supported on this platform");
28 }
29
30 virtual Result<void> RemoveSearchPath([[maybe_unused]] const std::filesystem::path& path) {
31 return MakeError("Runtime path modification not supported on this platform");
32 }
33 };
34
35 // Factory function (implemented per platform)
36 std::shared_ptr<IPlatformOps> CreatePlatformOps();
37}