#![no_std]
#![warn(clippy::pedantic, clippy::cargo, unsafe_op_in_unsafe_fn)]
#![allow(
clippy::missing_safety_doc,
clippy::missing_errors_doc,
clippy::missing_panics_doc,
clippy::module_name_repetitions,
clippy::multiple_crate_versions,
clippy::doc_markdown,
non_camel_case_types,
dead_code
)]
use core::{mem, ptr};
use coreclr_hosting_shared::{char_t, size_t};
#[cfg_attr(unix, link(name = "nethost", kind = "static"))]
#[cfg_attr(
all(unix, not(target_os = "macos")),
link(name = "stdc++", kind = "dylib")
)]
#[cfg_attr(target_os = "macos", link(name = "c++", kind = "dylib"))]
extern "system" {
pub fn get_hostfxr_path(
buffer: *mut char_t,
buffer_size: *mut size_t,
parameters: *const get_hostfxr_parameters,
) -> i32;
}
#[repr(C)]
pub struct get_hostfxr_parameters {
pub size: size_t,
pub assembly_path: *const char_t,
pub dotnet_root: *const char_t,
}
impl get_hostfxr_parameters {
#[must_use]
pub fn with_dotnet_root(dotnet_root: *const char_t) -> Self {
Self {
size: mem::size_of::<Self>(),
assembly_path: ptr::null(),
dotnet_root,
}
}
#[must_use]
pub fn with_assembly_path(assembly_path: *const char_t) -> Self {
Self {
size: mem::size_of::<Self>(),
assembly_path,
dotnet_root: ptr::null(),
}
}
}