use std::{mem::size_of, ptr};
use super::type_aliases::{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 {
pub fn with_dotnet_root(dotnet_root: *const char_t) -> get_hostfxr_parameters {
get_hostfxr_parameters {
size: size_of::<get_hostfxr_parameters>(),
assembly_path: ptr::null(),
dotnet_root,
}
}
pub fn with_assembly_path(assembly_path: *const char_t) -> get_hostfxr_parameters {
get_hostfxr_parameters {
size: size_of::<get_hostfxr_parameters>(),
assembly_path,
dotnet_root: ptr::null(),
}
}
}