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§
source§impl 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_name
andmethod_name
are.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 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_name
andmethod_name
are.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 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>
Available on crate feature net5_0
only.
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>
net5_0
only.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_name
andmethod_name
are.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 with [\[UnmanagedCallersOnly\]
].
sourcepub fn get_function<F: FunctionPtr>(
&self,
type_name: &PdCStr,
method_name: &PdCStr,
delegate_type_name: &PdCStr
) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>
Available on crate feature net5_0
only.
pub fn get_function<F: FunctionPtr>( &self, type_name: &PdCStr, method_name: &PdCStr, delegate_type_name: &PdCStr ) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>
net5_0
only.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_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>
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_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.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_name
to find. The method must be static and must match be annotated withUnmanagedCallersOnly
.