Skip to content

fix(platform): Windows 64-bit file I/O and MinGW build fixes - #59

Merged
danielsreichenbach merged 4 commits into
mainfrom
feat/win64-platform-fixes
Oct 3, 2026
Merged

danielsreichenbach merged 4 commits into
mainfrom
feat/win64-platform-fixes

Conversation

@danielsreichenbach

Copy link
Copy Markdown
Member
  • Fix fseek/ftell/mktime to use 64-bit variants on Windows (files >2GB, dates post-2038)
  • Only link ucrt on MSVC, not MinGW (MinGW uses msvcrt.dll)
  • Single bounds check for instruction fetch in VM hot loop

C  is 32-bit on Windows, so standard fseek/ftell can't handle
files >2GB. The _fseeki64/_ftelli64/_mktime64 variants are needed for
correctness on Windows. cfg_attr link_name redirects the symbols at
link time.
MinGW uses msvcrt.dll, not ucrtbase.dll. Unconditional #[link(name =
"ucrt")] breaks MinGW builds. Use cfg_attr to conditionally link ucrt
only when target_env is msvc.
Combine the separate len check and index access into a single .get(pc)
call. Matches PUC-Rio's  idiom where pc is advanced atomically
with the fetch, reducing branches in the hot loop.
@danielsreichenbach
danielsreichenbach merged commit ecd0083 into main Oct 3, 2026
6 checks passed
@danielsreichenbach
danielsreichenbach deleted the feat/win64-platform-fixes branch October 3, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant