Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions crates/libs/link/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ macro_rules! link {
macro_rules! link {
($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => (
#[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim")]
// TODO: remove hardcoded "C" before next major update - https://github.com/microsoft/windows-rs/pull/3669
extern "C" {
extern $abi {
$(#[link_name=$link_name])?
pub fn $($function)*;
}
Expand Down
14 changes: 14 additions & 0 deletions crates/tests/libs/link/tests/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,17 @@ fn cdecl() {
assert_eq!(LdapMapErrorToWin32(LDAP_BUSY), ERROR_BUSY);
}
}

// Test for https://github.com/microsoft/windows-rs/pull/3669#issuecomment-3097317771
#[test]
fn fn_ptr() {
windows_link::link!("kernel32.dll" "system" fn GetTickCount() -> u32);

type GetTickCountType = unsafe extern "system" fn() -> u32;

static GET_TICK_COUNT: GetTickCountType = GetTickCount;

unsafe {
GET_TICK_COUNT();
}
}
20 changes: 0 additions & 20 deletions crates/tests/misc/calling_convention/tests/ptr.rs

This file was deleted.