v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
38
source/core/StarDynamicLib.hpp
Normal file
38
source/core/StarDynamicLib.hpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef STAR_PLATFORM_HPP
|
||||
#define STAR_PLATFORM_HPP
|
||||
|
||||
#include "StarString.hpp"
|
||||
|
||||
namespace Star {
|
||||
|
||||
STAR_CLASS(DynamicLib);
|
||||
|
||||
class DynamicLib {
|
||||
public:
|
||||
// Returns the library extension normally used on the current platform
|
||||
// including the '.', e.g. '.dll', '.so', '.dylib'
|
||||
static String libraryExtension();
|
||||
|
||||
// Load a dll from the given filename. If the library is found and
|
||||
// succesfully loaded, returns a handle to the library, otherwise nullptr.
|
||||
static DynamicLibUPtr loadLibrary(String const& fileName);
|
||||
|
||||
// Load a dll from the given name, minus extension.
|
||||
static DynamicLibUPtr loadLibraryBase(String const& baseName);
|
||||
|
||||
// Should return handle to currently running executable. Will always
|
||||
// succeed.
|
||||
static DynamicLibUPtr currentExecutable();
|
||||
|
||||
virtual ~DynamicLib() = default;
|
||||
|
||||
virtual void* funcPtr(char const* name) = 0;
|
||||
};
|
||||
|
||||
inline DynamicLibUPtr DynamicLib::loadLibraryBase(String const& baseName) {
|
||||
return loadLibrary(baseName + libraryExtension());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue