#include <dll.h>
Interface for managing dynamic libraries (load, query symbols, ...).
Public Member Functions | |
MAXON_METHOD Result< void > | Unload () |
MAXON_METHOD Result< void > | Release () |
MAXON_METHOD Result< void * > | FindSymbolPointer (const CString &symbol) const |
template<typename T > | |
MAXON_FUNCTION Result< T > | FindSymbol (const CString &symbol) const |
MAXON_METHOD Result< Binary * > | GetBinary () const |
MAXON_METHOD Result< void > | UpdateSymbolData () |
MAXON_METHOD Result< Url > | GetPath () const |
Static Public Member Functions | |
static MAXON_METHOD Result< DllRef > | LoadDll (const Url &fileName, Bool registerDll, Bool requireCoreModule, Int systemDependentFlags=-1) |
static MAXON_METHOD Result< DllRef > | GetModule (const void *handle, UInt processId) |
static MAXON_METHOD Result< void > | AddDllPath (const Url &dllDirectory) |
static MAXON_METHOD Result< void > | RemoveDllPath (const Url &dllDirectory) |
static MAXON_METHOD Result< void > | GetLoadedDllsDeprecated (const ValueReceiver< const DllRef & > &dlls) |
static MAXON_METHOD Result< Bool > | GetLoadedDlls (const ValueReceiver< const DllRef & > &dlls) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (DllInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.dll", MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel")) | |
|
private |
|
static |
Loads the dll into memory. When the last reference disappears the dll will be unloaded automatically.
[in] | fileName | Filename of the dll to load. |
[in] | registerDll | If true the library will automatically be unloaded before the current module is unloaded. Make sure not to store the reference permanently (otherwise this can't work). |
[in] | requireCoreModule | Set this to false to load foreign libraries. Otherwise C4D specific symbols must be present. |
[in] | systemDependentFlags | Flags passed to the underlying OS function which opens the library. LoadLibrary on Windows, and dlopen on macOS and Linux. |
|
static |
Creates a DllRef from an already loaded module. The dll will not be unloaded when the reference is deleted.
[in] | handle | Handle to the module. This is a HMODULE on Windows and a void* on Linux and OSX. |
[in] | processId | Id of the process that owns the dll. |
|
static |
Adds a directory to the search path used to locate DLLs for the application (Windows only).
[in] | dllDirectory | The directory to be added to the search path. |
|
static |
Removes a directory from the library search path (Windows only).
[in] | dllDirectory | The directory to be removed from the search path. |
|
static |
Returns all loaded dlls which were loaded through DllInterface. @MAXON_ANNOTATION{methodId="GetLoadedDllsDeprecated@5a77b521b3ce6f53"->"GetLoadedDlls@5a77b521b3ce6f53"}
|
static |
Returns all loaded dlls which were loaded through DllInterface.
MAXON_METHOD Result<void> Unload | ( | ) |
Unloads the dll from memory.
MAXON_METHOD Result<void> Release | ( | ) |
Detaches this object from the system handle so that the dll will be unloaded when the application quits.
MAXON_METHOD Result<void*> FindSymbolPointer | ( | const CString & | symbol | ) | const |
Looks for a symbol and returns a generic pointer to it.
[in] | symbol | Symbol to find in the dll. |
MAXON_FUNCTION Result<T> FindSymbol | ( | const CString & | symbol | ) | const |
Looks for a symbol and returns the requested type (via cast).
[in] | symbol | Symbol to find in the dll. |
MAXON_METHOD Result<Binary*> GetBinary | ( | ) | const |
MAXON_METHOD Result<void> UpdateSymbolData | ( | ) |
Loads or updates symbol data for dynamic libraries. Depending on the OS (Windows) this has to be triggered manually after all modules have been loaded.
MAXON_METHOD Result<Url> GetPath | ( | ) | const |