2 ms·
You can also do it using ld - it's something like ld -r --format binary -o out.o <file>, although you do want some build system assistance to generate header fi
by CamouflagedKiwi 10mo ago
You can also do it using ld - it's something like ld -r --format binary -o out.o <file>, 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 up the size of the embedded file by 2-4x) and slow to compile.
All a bit less relevant now since recent C++ versions have this built in by default. Generally something languages have been IMO too slow on (e.g. Go picked this up four or so years ago, after a bunch of less nice home-grown alternatives), it's actually just really useful to make things work in the real world, especially for languages that you can distribute as single-file binaries (which IMO should be all of them, but sadly it's not always).
- jcalvinowens 10mo agoThe 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/17b3533b4cd820309443f7cefff7cc40af0340bb https://github.com/jcalvinowens/ircam-viewer/commit/17b3533b...
- duped 10mo agoIt's also not reliable for most architectures.