Outdated, modern solution is baked in now https://en.cppreference.com/w/c/preprocessor/embed
The thing that always irks me about c++ is this sort of thing: > Explanation 1) Searches for the resource identified by h-char-sequence in implementation-defined manner. Okay, so now I have to make assumptions that the implementation is reasonable, and won't go and "search" by asking an LLM or accidentally revealing my credit card details to a third party, right? And even if the implementation _is_ reasonable the onl…
C/C++ Embedded Files (2013)
31–40 of 57 posts
Re: C/C++ Embedded Files (2013)
#32Re: C/C++ Embedded Files (2013)
#33Outdated, modern solution is baked in now https://en.cppreference.com/w/c/preprocessor/embed
The thing that always irks me about c++ is this sort of thing: > Explanation 1) Searches for the resource identified by h-char-sequence in implementation-defined manner. Okay, so now I have to make assumptions that the implementation is reasonable, and won't go and "search" by asking an LLM or accidentally revealing my credit card details to a third party, right? And even if the implementation _is_ reasonable the onl…
Re: C/C++ Embedded Files (2013)
#34You can also do it using ld - it's something like ld -r --format binary -o out.o , although you do want some build system assistance to generate header files allowing you to access the thing (somewhat similar to the assembly example here). It's a bit of a performance but I strongly prefer it to generating header files in the earlier options - those header files can end up being _very_ large (they generally multiply u…
The special ld argument is a gnu thing, it's not portable and at least lld doesn't support it. https://github.com/jcalvinowens/ircam-viewer/commit/17b3533b...
Re: C/C++ Embedded Files (2013)
#35it might be a bit 'arcane' way to do it idk... but to me it always seemed the logical way.. u can also define symbols etc around it and use extern in ur c/cpp program to reference those.to access the data in light of dynamic linking / alsr etc.
here is some resource on it with some examples: https://wiki.osdev.org/Linker_Scripts
u can include any file. another executable, images, etc. etc. no need for weird stuff in the c sources?
on the flipside, is there a benefit of doing it inside the source code?? (apart from not having to roll ur own linker script and learn that dragon?)
Re: C/C++ Embedded Files (2013)
#36Outdated, modern solution is baked in now https://en.cppreference.com/w/c/preprocessor/embed
let me know when my embedded target's compiler is C23 compliant (i mean, i whish. we may be getting C11 or even C17 some times next year but i'm not holding my breath)
Re: C/C++ Embedded Files (2013)
#37Earlier quoted context omitted.
Python is pretty much mandatory for Linux systems nowadays, unless you're dealing with something really minimalist or trying to be very portable it's safe to rely on.
> it's safe to rely on Is there any guarantee they won't break backwards compatibility again?
Arguably it could be a little C helper, but I wanted this particular piece of the project to be more accessible so I used a scripting language.
Re: C/C++ Embedded Files (2013)
#38Outdated, modern solution is baked in now https://en.cppreference.com/w/c/preprocessor/embed
let me know when my embedded target's compiler is C23 compliant (i mean, i whish. we may be getting C11 or even C17 some times next year but i'm not holding my breath)
Re: C/C++ Embedded Files (2013)
#39Re: C/C++ Embedded Files (2013)
#40Outdated, modern solution is baked in now https://en.cppreference.com/w/c/preprocessor/embed