VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
PluginDescriptor.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <cstddef>
5
6#if defined(_WIN32)
7#define VOLTMOD_EXPORT __declspec(dllexport)
8#else
9#define VOLTMOD_EXPORT __attribute__((visibility("default")))
10#endif
11
12namespace VoltMod
13{
14
15/** What a plugin library exports. @ref VoltModVersion stays first: the host reads it before anything else. */
17{
18 /** The VoltMod release the plugin was built with; the host loads only its own. */
19 const char* VoltModVersion;
20
21 /** The short commit the plugin was built from. */
22 const char* BuildStamp;
23
24 /** Attach to @p host. On false, write why into @p error, which holds @p errorSize bytes. */
25 bool (*Load)(IPluginContext* host, char* error, size_t errorSize);
26
27 /** Release everything Load took. The host frees the library only after this returns. */
29
30 /** This plugin's status as JSON it owns, valid until the next call. */
31 const char* (*Status)();
32};
33
34/** The one symbol the host resolves in a plugin library. A new name whenever the descriptor's layout
35 * changes, so an older library is never read. */
36inline constexpr const char* PluginEntryName = "VoltMod_Plugin";
37
38} // namespace VoltMod
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
constexpr const char * PluginEntryName
bool(* Load)(IPluginContext *host, char *error, size_t errorSize)