macro_rules! link {
($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => { ... };
}Expand description
Declares an external function from a dynamically linked library.
§Arguments
$library- A string literal representing the name of the shared library (e.g.,"ntdll.dll").$abi- A string literal specifying the calling convention (e.g.,"system"for Windows API calls).$link_name(optional) - A string literal specifying the actual name of the function in the library.$function- The function signature to declare.
§Example
ⓘ
link!("ntdll.dll" "system" fn NtQueryInformationProcess(
process_handle: HANDLE,
process_info_class: u32,
process_info: *mut u8,
process_info_length: u32,
return_length: *mut u32
) -> u32);