Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::DynamicModuleHandle Class Referenceabstract

#include <DynamicModuleHandle.h>

Public Member Functions

virtual ~DynamicModuleHandle ()=default
 Platform-specific implementation should call Unload().
 
 DynamicModuleHandle (const DynamicModuleHandle &)=delete
 
DynamicModuleHandleoperator= (const DynamicModuleHandle &)=delete
 
bool Load (bool isInitializeFunctionRequired)
 
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< DynamicModuleHandleCreate (const char *fullFileName)
 

Protected Types

enum class  LoadStatus { LoadSuccess , LoadFailure , AlreadyLoaded }
 

Protected Member Functions

 DynamicModuleHandle (const char *fileFullName)
 
virtual LoadStatus LoadModule ()=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
 

Detailed Description

Handles platform-specific interaction with dynamic modules (aka DLLs, aka dynamic link libraries, aka shared libraries).

Member Function Documentation

◆ Create()

static AZStd::unique_ptr< DynamicModuleHandle > AZ::DynamicModuleHandle::Create ( const char *  fullFileName)
static

Creates a platform-specific DynamicModuleHandle. Note that the specified module is not loaded until Load is called.

◆ GetFilename()

const char * AZ::DynamicModuleHandle::GetFilename ( ) const
inline
Returns
the module's name on disk.

◆ GetFunction()

template<typename Function >
Function AZ::DynamicModuleHandle::GetFunction ( const char *  functionName) const
inline

Returns a function from the module. nullptr is returned if the function is inaccessible or the module is not loaded.

◆ IsLoaded()

virtual bool AZ::DynamicModuleHandle::IsLoaded ( ) const
pure virtual
Returns
whether the module has been successfully loaded.

◆ Load()

bool AZ::DynamicModuleHandle::Load ( bool  isInitializeFunctionRequired)

Loads the module. Invokes the InitializeDynamicModuleFunction if it is found in the module and this is the first time loading the module.

Parameters
isInitializeFunctionRequiredWhether a missing InitializeDynamicModuleFunction causes the Load to fail.
Returns
True if the module loaded successfully.

◆ Unload()

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.

Returns
true if the module unloaded successfully.

The documentation for this class was generated from the following file: