#include <DynamicModuleHandle.h>
Public Types | |
| enum class | LoadFlags : uint32_t { None = 0 , InitFuncRequired = 1 << 0 , GlobalSymbols = 1 << 1 , NoLoad = 1 << 2 } |
| Flags used for loading a dynamic module. More... | |
Public Member Functions | |
| virtual | ~DynamicModuleHandle ()=default |
| Platform-specific implementation should call Unload(). | |
| DynamicModuleHandle (const DynamicModuleHandle &)=delete | |
| DynamicModuleHandle & | operator= (const DynamicModuleHandle &)=delete |
| bool | Load (bool isInitializeFunctionRequired, bool globalSymbols=false) |
| bool | Load (LoadFlags flags=LoadFlags::None) |
| bool | Unload () |
| virtual bool | IsLoaded () const =0 |
| const char * | GetFilename () const |
| template<typename Function > | |
| Function | GetFunction (const char *functionName) const |
Static Public Member Functions | |
| static AZStd::unique_ptr< DynamicModuleHandle > | Create (const char *fullFileName, bool correctModuleName=true) |
Protected Types | |
| enum class | LoadStatus { LoadSuccess , LoadFailure , AlreadyLoaded } |
Protected Member Functions | |
| DynamicModuleHandle (const char *fileFullName) | |
| template<typename T > | |
| constexpr bool | CheckBitsAny (T v, T bits) |
| virtual LoadStatus | LoadModule (LoadFlags flags)=0 |
| virtual bool | UnloadModule ()=0 |
| virtual void * | GetFunctionAddress (const char *functionName) const =0 |
Protected Attributes | |
| AZ::IO::FixedMaxPathString | m_fileName |
| Store the module name for future loads. | |
| AZ::EnvironmentVariable< bool > | m_initialized |
Handles platform-specific interaction with dynamic modules (aka DLLs, aka dynamic link libraries, aka shared libraries).
Flags used for loading a dynamic module.
| Enumerator | |
|---|---|
| GlobalSymbols | Whether a missing InitializeDynamicModuleFunction causes the Load to fail. |
| NoLoad | On platforms that support it, make the module's symbols global and available for the relocation processing of other modules. Otherwise, the symbols need to be queried manually. |
|
static |
Creates a platform-specific DynamicModuleHandle.
| fullFileName | The file name of the dynamic module to load |
| correctModuleName | Option to correct the filename to conform to the current platform's dynamic module naming convention. (i.e. lib<ModuleName>.so on unix-like platforms) |
Note that the specified module is not loaded until Load is called.
Returns a function from the module. nullptr is returned if the function is inaccessible or the module is not loaded.
| bool AZ::DynamicModuleHandle::Load | ( | bool | isInitializeFunctionRequired, |
| bool | globalSymbols = false |
||
| ) |
Loads the module. Invokes the InitializeDynamicModuleFunction if it is found in the module and this is the first time loading the module.
| isInitializeFunctionRequired | Whether a missing InitializeDynamicModuleFunction causes the Load to fail. |
| globalSymbols | On platforms that support it, make the module's symbols global and available for the relocation processing of other modules. Otherwise, the symbols need to be queried manually. |
Loads the module. Invokes the InitializeDynamicModuleFunction if it is found in the module and this is the first time loading the module.
| flags | Flags to control the loading of the module. LoadFlags |
| bool AZ::DynamicModuleHandle::Unload | ( | ) |
Unload the module. Invokes the UninitializeDynamicModuleFunction if it is found in the module and this was the first handle to load the module.