On a side note, the build is quickly growing 🧐

A relevant part of it comes from "embedding" #binary #png images into the executable. Here's indeed a weakness of my favorite #programming language: #C. There's just no standard way to include binary data 😒

In the past, I had hacked something together with #objcopy. Non-portable, and doesn't work any more with the llvm tooling installed with #FreeBSD 13.3. I tried the #incbin pseudo-opcode which worked perfectly, but that's non-portable as well, you can't rely on the #assembler to support it. So I took the only portable route, generating C source (embedding the binary data into "string literals"), which requires a separate little tool built in a sub-make 🤯

This is really a feature #C desperately needs: a standard way to embed binary data.

#incbin in a header file? Wha...?

No, it's not preprocessor voodoo. It just uses inline asm() to leverage the assembler's native .incbin directive. But it's like, a really big macro.

(brb, starting a petition to include #pragma incbin into every C compiler.)

https://github.com/graphitemaster/incbin

GitHub - graphitemaster/incbin: Include binary files in C/C++

Include binary files in C/C++. Contribute to graphitemaster/incbin development by creating an account on GitHub.

GitHub

#incbin is a #publicdomain #C macro that includes binary files.

incbin includes binary files into C translation units by using the inline assembler (or the incbin translator) to load in and calculate the size of the file. The file is loaded into a buffer with a size variable and end pointer at compile time. The file is compiled into the binary, allowing the data to be used even if the binary is moved.

Website 🔗️: https://github.com/graphitemaster/incbin

#free #opensource #foss #fossmendations #programming

GitHub - graphitemaster/incbin: Include binary files in C/C++

Include binary files in C/C++. Contribute to graphitemaster/incbin development by creating an account on GitHub.

GitHub