Struct netcorehost::hostfxr::DelegateLoader
source · [−]pub struct DelegateLoader { /* private fields */ }netcore3_0 only.Expand description
A struct for loading pointers to managed functions for a given HostfxrContext.
Implementations
sourceimpl DelegateLoader
impl DelegateLoader
sourcepub fn load_assembly_and_get_function<F: FunctionPtr>(
&self,
assembly_path: &PdCStr,
type_name: &PdCStr,
method_name: &PdCStr,
delegate_type_name: &PdCStr
) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>
pub fn load_assembly_and_get_function<F: FunctionPtr>(
&self,
assembly_path: &PdCStr,
type_name: &PdCStr,
method_name: &PdCStr,
delegate_type_name: &PdCStr
) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>
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.
Once loaded it will find the specified type and method and return a native function pointer
to that method.
Arguments
assembly_path: Path to the assembly to load. In case of complex component, this should be the main assembly of the component (the one with the .deps.json next to it). Note that this does not have to be the assembly from which thetype_nameandmethod_nameare.type_name: Assembly qualified type name to findmethod_name: Name of the method on thetype_nameto 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 load_assembly_and_get_function_with_default_signature(
&self,
assembly_path: &PdCStr,
type_name: &PdCStr,
method_name: &PdCStr
) -> Result<ManagedFunctionWithDefaultSignature, GetManagedFunctionError>
pub fn load_assembly_and_get_function_with_default_signature(
&self,
assembly_path: &PdCStr,
type_name: &PdCStr,
method_name: &PdCStr
) -> Result<ManagedFunctionWithDefaultSignature, GetManagedFunctionError>
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.
Once loaded it will find the specified type and method and return a native function pointer
to that method.
Arguments
assembly_path: Path to the assembly to load. In case of complex component, this should be the main assembly of the component (the one with the .deps.json next to it). Note that this does not have to be the assembly from which thetype_nameandmethod_nameare.type_name: Assembly qualified type name to findmethod_name: Name of the method on thetype_nameto find. The method must be static and must match the following signature:public delegate int ComponentEntryPoint(IntPtr args, int sizeBytes);
sourcepub fn load_assembly_and_get_function_with_unmanaged_callers_only<F: FunctionPtr>(
&self,
assembly_path: &PdCStr,
type_name: &PdCStr,
method_name: &PdCStr
) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>
pub fn load_assembly_and_get_function_with_unmanaged_callers_only<F: FunctionPtr>(
&self,
assembly_path: &PdCStr,
type_name: &PdCStr,
method_name: &PdCStr
) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>
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.
Once loaded it will find the specified type and method and return a native function pointer
to that method. The target method has to be annotated with the UnmanagedCallersOnlyAttribute.
Arguments
assembly_path: Path to the assembly to load. In case of complex component, this should be the main assembly of the component (the one with the .deps.json next to it). Note that this does not have to be the assembly from which thetype_nameandmethod_nameare.type_name: Assembly qualified type name to findmethod_name: Name of the method on thetype_nameto find. The method must be static and must match be annotated with [\[UnmanagedCallersOnly\]].
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>
Calling this function will find the specified type and method and return a native function pointer to that method. This will NOT load the containing assembly.
Arguments
type_name: Assembly qualified type name to findmethod_name: Name of the method on thetype_nameto 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>
Calling this function will find the specified type and method and return a native function pointer to that method. This will NOT load the containing assembly.
Arguments
type_name: Assembly qualified type name to findmethod_name: Name of the method on thetype_nameto 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>
pub fn get_function_with_unmanaged_callers_only<F: FunctionPtr>(
&self,
type_name: &PdCStr,
method_name: &PdCStr
) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>
Calling this function will find the specified type and method and return a native function pointer to that method. This will NOT load the containing assembly.
Arguments
type_name: Assembly qualified type name to findmethod_name: Name of the method on thetype_nameto find. The method must be static and must match be annotated withUnmanagedCallersOnly.
Trait Implementations
sourceimpl Clone for DelegateLoader
impl Clone for DelegateLoader
sourcefn clone(&self) -> DelegateLoader
fn clone(&self) -> DelegateLoader
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl RefUnwindSafe for DelegateLoader
impl !Send for DelegateLoader
impl !Sync for DelegateLoader
impl Unpin for DelegateLoader
impl UnwindSafe for DelegateLoader
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more