Skip to content

cStd cRuntimeLibrary in __traits(getTargetInfo)? #3372

@dlangBugzillaToGithub

Description

@dlangBugzillaToGithub

Manu reported this on 2024-11-16T12:24:34Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=24862

Description

__traits(getTargetInfo) can report "cppRuntimeLibrary" and "cppStd" (the complementary C++ compiler's language version)...

Can we also add "cRuntimeLibrary" and "cStd"? Since C has its own language standard revisions and runtime libs...

Particularly, this needs support from LDC and GDC too.

The runtime library is straightforward; just return the name of the native runtime library (or the name of the specified CRT if an override lib was given on the command line).

cStd to report the language standard version is possibly as little more tricky.
It doesn't affect the binary in any way I know of like the cppStd does, but the language standard does affect what symbols the program can expect to find in the C runtime library.

GDC knows what crt it was built for and the complementary gcc build will also match the reported values by default.
LDC similarly, although it doesn't assume a complementary compiler; it should probably report the language expressed by the crt library.
DMD has platform specific behaviour.

It's a shame that C++ uses the build option `extern-std`, because it doesn't make it easy to select a similar name to control what C language standard we plan to link against...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions