diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:25 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:25 +0300 |
commit | 344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/system/dynlib.h | |
parent | 706b83ed7de5a473436620367af31fc0ceecde07 (diff) | |
download | ydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'util/system/dynlib.h')
-rw-r--r-- | util/system/dynlib.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/util/system/dynlib.h b/util/system/dynlib.h index 6c4a1b0dd5..66eaf4a5c1 100644 --- a/util/system/dynlib.h +++ b/util/system/dynlib.h @@ -3,7 +3,7 @@ #include "defaults.h" #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #define Y_GET_FUNC(dll, name) FUNC_##name((dll).Sym(#name)) #define Y_GET_FUNC_OPTIONAL(dll, name) FUNC_##name((dll).SymOptional(#name)) @@ -22,15 +22,15 @@ class TDynamicLibrary { public: - TDynamicLibrary() noexcept; - TDynamicLibrary(const TString& path, int flags = DEFAULT_DLLOPEN_FLAGS); - ~TDynamicLibrary(); + TDynamicLibrary() noexcept; + TDynamicLibrary(const TString& path, int flags = DEFAULT_DLLOPEN_FLAGS); + ~TDynamicLibrary(); void Open(const char* path, int flags = DEFAULT_DLLOPEN_FLAGS); - void Close() noexcept; - void* SymOptional(const char* name) noexcept; + void Close() noexcept; + void* SymOptional(const char* name) noexcept; void* Sym(const char* name); - bool IsLoaded() const noexcept; + bool IsLoaded() const noexcept; void SetUnloadable(bool unloadable); // Set to false to avoid unloading on destructor private: @@ -44,11 +44,11 @@ class TExternalSymbol { private: TLib* PLib; TDynamicLibrary* DLib; - TString lname; - TString vname; + TString lname; + TString vname; public: - TExternalSymbol() noexcept { + TExternalSymbol() noexcept { PLib = nullptr; DLib = nullptr; } @@ -70,7 +70,7 @@ public: } return *this; } - ~TExternalSymbol() { + ~TExternalSymbol() { delete DLib; } // set the symbol from dynamic source @@ -90,30 +90,30 @@ public: vname = vtbl_name; } // set the symbol from static source - void SetSym(TLib* pl) noexcept { + void SetSym(TLib* pl) noexcept { if (DLib == nullptr && PLib == nullptr) PLib = pl; } - void Close() noexcept { + void Close() noexcept { delete DLib; DLib = 0; PLib = 0; lname.remove(); vname.remove(); } - TLib* Symbol() const noexcept { + TLib* Symbol() const noexcept { return PLib; } - const TString& LibName() const noexcept { + const TString& LibName() const noexcept { return lname; } - const TString& VtblName() const noexcept { + const TString& VtblName() const noexcept { return vname; } - bool IsStatic() const noexcept { + bool IsStatic() const noexcept { return DLib == nullptr && PLib != nullptr; } - bool IsDynamic() const noexcept { + bool IsDynamic() const noexcept { return DLib && DLib->IsLoaded() && PLib != nullptr; } }; |