Announcement

Collapse
No announcement yet.

LLVM Clang 19 Lands Support For C23's #embed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • LLVM Clang 19 Lands Support For C23's #embed

    Phoronix: LLVM Clang 19 Lands Support For C23's #embed

    Merged today to LLVM Clang 19 Git is support for the #embed resource inclusion mechanism that is an approved C23 feature. This also makes Clang the first for supporting this pre-processor embed feature...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    I remember how difficult this feature was to get added.

    Comment


    • #3
      Ah! Very nice. I've had to do non-standard inline asm stuff to make this work in the past. Though if Visual Studio refuses to implement it, then it's still kinda worthless. :S It's easy enough to make GCC/Clang do it with the same snippet already.

      Comment


      • #4
        In Rust include_bytes! and include_str! macros are available since 1.0.0 (i.e. since 2015).

        Go C++?

        Comment


        • #5
          I've done this the bad, old way as recently as last year. That means writing a little tool to transform the data into array definitions with literal initializers and creating buildsystem infrastructure to invoke it.

          Back when I did some assembly language development for an embedded platform, I remember fiddling with some of our linker scripts. The linker can do a lot that's not directly exposed via C. I briefly considered invoking the linker directly, rather than via gcc, but decided my coworkers would probably prefer the former approach and went that way.

          Comment


          • #6
            Why preprocessor directive instead of macro though?

            Comment


            • #7
              Originally posted by cend View Post
              Why preprocessor directive instead of macro though?
              I assume because one of the reasons given for needing it was that the amount of binary data real-world projects were including manually was starting to have a measurable effect on compile times in some cases, so making it a preprocessor directive would draw attention to it being special-cased at the compiler level.

              Comment

              Working...
              X