Skip to content

cgen: complete Windows CRT stream declarations - #27948

Merged
medvednikov merged 1 commit into
vlang:masterfrom
GGRei:fix/windows-tcc-wfreopen-preamble
Jul 27, 2026
Merged

medvednikov merged 1 commit into
vlang:masterfrom
GGRei:fix/windows-tcc-wfreopen-preamble

Conversation

@GGRei

@GGRei GGRei commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Complete the manual Windows CRT prelude with the missing declarations for _wfreopen, _fseeki64, fgetpos, _wpopen, and _pclose.

Add Windows TinyCC runtime regressions covering:

  • os.File.reopen
  • the _wpopen / _pclose command-pipe lifecycle
  • the existing embed_issue_12035 full generated-C path

Additional note

Strict Windows TCC validation also exposed a missing freopen_s declaration in the generated C prelude. This PR now includes the correct declaration and a regression test covering Windows GUI builds with -subsystem windows.

The existing declarations and behavior remain unchanged. The complete targeted Windows TCC smoke passed.

Cause

V's generated C uses a manual CRT prelude. Some Windows CRT functions used by the compiled modules were not visible to TinyCC through that prelude, causing implicit-function-declaration failures with -no-retry-compilation.

The symbols already exist in the Windows CRT and tccbin exports. This was a generated-C declaration visibility issue, not a pkg-config or linker-library issue.

Validation

Native Windows TinyCC smoke passed with no fallback:

  • File.reopen compile, link, and runtime
  • _wpopen / _pclose runtime
  • embed_issue_12035 -prod -no-skip-unused
  • complete coutput_test.v
  • direct generated-C collector with zero implicit symbols

@GGRei

GGRei commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Ready Alex Thanks!

PS: The Windows TCC job now gets much further. It still fails on missing strict declarations for CancelIoEx and freopen_s in the Windows amd64 TCC/V path. I will address those separately later.

@GGRei
GGRei force-pushed the fix/windows-tcc-wfreopen-preamble branch from 0127024 to e0b816e Compare July 27, 2026 07:38
@GGRei

GGRei commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: e0b816e324

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@medvednikov
medvednikov merged commit bdaf88c into vlang:master Jul 27, 2026
90 of 95 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants