1#include <Foundation/FoundationInternal.h>
2PL_FOUNDATION_INTERNAL_HEADER
6#include <Foundation/Configuration/Plugin.h>
7#include <Foundation/IO/OSFile.h>
8#include <Foundation/Logging/Log.h>
9#include <Foundation/Strings/StringBuilder.h>
10#include <Foundation/System/Process.h>
12using plPluginModule =
void*;
14bool plPlugin::PlatformNeedsPluginCopy()
23 sOriginalFile.
Append(
".so");
28 if (uiFileCopyNumber > 0)
31 sCopiedFile.
Append(
".loaded");
36 if (dlclose(Module) != 0)
39 plLog::Error(
"Could not unload plugin '{0}'. Error {1}", sPluginFile.
GetData(tmp),
static_cast<const char*
>(dlerror()));
49 Module = dlopen(sFileToLoad.
GetData(tmp), RTLD_NOW | RTLD_GLOBAL);
50 if (Module ==
nullptr)
52 plLog::Error(
"Could not load plugin '{0}'. Error {1}.\nSet the environment variable LD_DEBUG=all to get more information.", sPluginFile.
GetData(tmp),
static_cast<const char*
>(dlerror()));
static void Error(plLogInterface *pInterface, const plFormatString &string)
An error that needs to be fixed as soon as possible.
Definition Log.cpp:375
static plStringView GetApplicationDirectory()
Returns the path to the directory in which the application binary is located.
Definition OSFile.cpp:331
plStringBuilder is a class that is meant for creating and modifying strings.
Definition StringBuilder.h:35
void Append(plUInt32 uiChar)
Appends a single Utf32 character.
Definition StringBuilder_inl.h:94
void AppendFormat(const plFormatString &string)
Appends a formatted string. Uses '{}' formatting placeholders, see plFormatString for details.
Definition StringBuilder.cpp:1251
void AppendPath(plStringView sPath1, plStringView sPath2={}, plStringView sPath3={}, plStringView sPath4={})
Appends several path pieces. Makes sure they are always properly separated by a slash.
Definition StringBuilder.cpp:866
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
const char * GetData(plStringBuilder &ref_sTempStorage) const
Returns the data as a zero-terminated string.
Definition StringView.cpp:15
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54