Struct netcorehost::hostfxr::AssemblyDelegateLoader
source · pub struct AssemblyDelegateLoader { /* private fields */ }
netcore3_0
only.Expand description
A struct for loading pointers to managed functions for a given HostfxrContext
which automatically loads the
assembly from the given path on the first access.
Implementations§
source§impl AssemblyDelegateLoader
impl AssemblyDelegateLoader
sourcepub fn new(loader: DelegateLoader, assembly_path: impl Into<PdCString>) -> Self
pub fn new(loader: DelegateLoader, assembly_path: impl Into<PdCString>) -> Self
Creates a new AssemblyDelegateLoader
wrapping the given DelegateLoader
loading the assembly
from the given path on the first access.
sourcepub fn get_function<F: FunctionPtr>(
&self,
type_name: &PdCStr,
method_name: &PdCStr,
delegate_type_name: &PdCStr
) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>
pub fn get_function<F: FunctionPtr>( &self, type_name: &PdCStr, method_name: &PdCStr, delegate_type_name: &PdCStr ) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>
If this is the first loaded function pointer, calling this function will load the specified assembly in
isolation (into its own AssemblyLoadContext
) and it will use AssemblyDependencyResolver
on it to provide
dependency resolution.
Otherwise or once loaded it will find the specified type and method and return a native function pointer to that method.
Calling this function will find the specified type and method and return a native function pointer to that method.
§Arguments
type_name
: Assembly qualified type name to findmethod_name
: Name of the method on thetype_name
to find. The method must be static and must match the signature ofdelegate_type_name
.delegate_type_name
: Assembly qualified delegate type name for the method signature.
sourcepub fn get_function_with_default_signature(
&self,
type_name: &PdCStr,
method_name: &PdCStr
) -> Result<ManagedFunctionWithDefaultSignature, GetManagedFunctionError>
pub fn get_function_with_default_signature( &self, type_name: &PdCStr, method_name: &PdCStr ) -> Result<ManagedFunctionWithDefaultSignature, GetManagedFunctionError>
If this is the first loaded function pointer, calling this function will load the specified assembly in
isolation (into its own AssemblyLoadContext
) and it will use AssemblyDependencyResolver
on it to provide
dependency resolution.
Otherwise or once loaded it will find the specified type and method and return a native function pointer to that method.
Calling this function will find the specified type and method and return a native function pointer to that method.
§Arguments
type_name
: Assembly qualified type name to findmethod_name
: Name of the method on thetype_name
to find. The method must be static and must match the following signature:public delegate int ComponentEntryPoint(IntPtr args, int sizeBytes);
sourcepub fn get_function_with_unmanaged_callers_only<F: FunctionPtr>(
&self,
type_name: &PdCStr,
method_name: &PdCStr
) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>
Available on crate feature net5_0
only.
pub fn get_function_with_unmanaged_callers_only<F: FunctionPtr>( &self, type_name: &PdCStr, method_name: &PdCStr ) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>
net5_0
only.If this is the first loaded function pointer, calling this function will load the specified assembly in
isolation (into its own AssemblyLoadContext
) and it will use AssemblyDependencyResolver
on it to provide
dependency resolution.
Otherwise or once loaded it will find the specified type and method and return a native function pointer to that method.
Calling this function will find the specified type and method and return a native function pointer to that method.
§Arguments
type_name
: Assembly qualified type name to findmethod_name
: Name of the method on thetype_name
to find. The method must be static and must match be annotated withUnmanagedCallersOnly
.
Trait Implementations§
source§impl Clone for AssemblyDelegateLoader
impl Clone for AssemblyDelegateLoader
source§fn clone(&self) -> AssemblyDelegateLoader
fn clone(&self) -> AssemblyDelegateLoader
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more