Skip to content

Commit c826dea

Browse files
committed
stdlib: link against legacy_stdio_definitions on Windows
Because Microsoft inlines the definitions of the printf family of functions, we end up with undefined references to them. Add an explicit request to link against the `legacy_stdio_definitions` library when `ucrt.C.stdio` is used which provides out-of-line definitions for them. This fixes the building of the `stdlib/VarArgs' test.
1 parent 7b0d10e commit c826dea

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

stdlib/public/Platform/ucrt.modulemap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ module ucrt [system] {
6060
module stdio {
6161
header "stdio.h"
6262
export *
63+
64+
// NOTE(compnerd) this is a horrible workaround for the fact that
65+
// Microsoft has fully inlined nearly all of the printf family of
66+
// functions in the headers which results in the definitions being elided
67+
// resulting in undefined symbols. The legacy_stdio_definitions provides
68+
// out-of-line definitions for these functions.
69+
link "legacy_stdio_definitions"
6370
}
6471

6572
module stdlib {

0 commit comments

Comments
 (0)