DllInterface Class Reference

#include <dll.h>

详细描述

Interface for managing dynamic libraries (load, query symbols, ...).

公共成员函数

MAXON_METHOD Result < void >  Unload ()
MAXON_METHOD Result < void >  发行 ()
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 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 >  GetLoadedDlls (const ValueReceiver < const DllRef & > &dlls)

私有成员函数

  MAXON_INTERFACE_NONVIRTUAL ( DllInterface , MAXON_REFERENCE_NORMAL , "net.maxon.interface.dll")

成员函数文档编制

◆  MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( DllInterface   ,
MAXON_REFERENCE_NORMAL   ,
"net.maxon.interface.dll"   
)
private

◆  LoadDll()

static MAXON_METHOD Result <DllRef> LoadDll ( const Url fileName ,
Bool   registerDll ,
Bool   requireCoreModule ,
Int   systemDependentFlags = -1  
)
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.
返回
Returns the dll reference or an error.

◆  GetModule()

static MAXON_METHOD Result <DllRef> GetModule ( const void *  handle ,
UInt   processId  
)
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.
返回
Returns the dll reference or an error.

◆  AddDllPath()

static MAXON_METHOD Result <void> AddDllPath ( const Url dllDirectory )
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.
返回
OK on success.

◆  RemoveDllPath()

static MAXON_METHOD Result <void> RemoveDllPath ( const Url dllDirectory )
static

Removes a directory from the library search path (Windows only).

参数
[in] dllDirectory The directory to be removed from the search path.
返回
OK on success.

◆  GetLoadedDlls()

static MAXON_METHOD Result <void> GetLoadedDlls ( const ValueReceiver < const DllRef & > &  dlls )
static

Returns all loaded dlls which were loaded through DllInterface .

◆  Unload()

MAXON_METHOD Result <void> Unload ( )

Unloads the dll from memory.

返回
OK on success.

◆  Release()

MAXON_METHOD Result <void> Release ( )

Detaches this object from the system handle so that the dll will be unloaded when the application quits.

返回
OK on success. @MAXON_ANNOTATION{default=OK}

◆  FindSymbolPointer()

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.
返回
Returns pointer to the symbol in the dll.

◆  FindSymbol()

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.
返回
Returns pointer to the symbol in the dll and casts it to the expected type.

◆  GetBinary()

MAXON_METHOD Result <Binary*> GetBinary ( ) const

◆  UpdateSymbolData()

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.

◆  GetPath()

MAXON_METHOD Result < Url > GetPath ( ) const

Returns the location ( Url ) of the dll.

返回
Url of the loaded dll.