Skip to content

std.builtin.subsystem reports .Windows for console applications #25127

@castholm

Description

@castholm

Zig Version

0.15.1

Steps to Reproduce and Observed Behavior

const std = @import("std");

pub fn main() void {
    std.debug.print("{?}\n", .{std.builtin.subsystem});
}
PS C:\tmp> zig build-exe .\repro.zig
PS C:\tmp> .\repro.exe
.Windows
PS C:\tmp> objdump .\repro.exe -Pheader | sls Subsystem
Major Subsystem Version:        6
Minor Subsystem Version:        0
Subsystem:                      3

3 is IMAGE_SUBSYSTEM_WINDOWS_CUI, 2 is IMAGE_SUBSYSTEM_WINDOWS_GUI. You also know that it's not a GUI application by the fact that it prints to the console.

Expected Behavior

std.builtin.subsystem does not report incorrect information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.os-windowsMicrosoft Windowsstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions