Skip to content

fix: link ucrt on Windows MSVC for libc FFI symbols - #23

Merged
danielsreichenbach merged 1 commit into
mainfrom
fix/windows-msvc-linking
Feb 20, 2026
Merged

danielsreichenbach merged 1 commit into
mainfrom
fix/windows-msvc-linking

Conversation

@danielsreichenbach

Copy link
Copy Markdown
Member

Summary

  • Add #[link(name = "ucrt")] to extern blocks declaring C runtime functions on Windows MSVC
  • Fixes unresolved symbols: gmtime_s, localtime_s, fprintf, fscanf

Closes #21

Test plan

  • CI passes on Linux (no change in behavior)
  • Release binary workflow succeeds for x86_64-pc-windows-msvc on next tag

Add #[link(name = "ucrt")] to extern blocks declaring C runtime
functions on Windows MSVC. Without this, the linker cannot resolve
gmtime_s, localtime_s, fprintf, and fscanf when building release
binaries for x86_64-pc-windows-msvc.

The main extern block uses cfg_attr to only apply the link attribute
on MSVC targets. Windows-specific blocks (iob_func, popen/pclose,
localtime_s/gmtime_s) use #[link] directly since they are already
gated behind #[cfg(target_os = "windows")].

Closes #21
@danielsreichenbach
danielsreichenbach merged commit f23722d into main Feb 20, 2026
6 checks passed
@danielsreichenbach
danielsreichenbach deleted the fix/windows-msvc-linking branch February 20, 2026 05:42
@danielsreichenbach danielsreichenbach self-assigned this Feb 20, 2026
@danielsreichenbach danielsreichenbach added the bug Something isn't working label Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Development

Successfully merging this pull request may close these issues.

bug: Windows MSVC release build fails with unresolved libc symbols

1 participant