Remix.run Logo
saidnooneever 6 hours ago

you could also use the linker to link in basically anything into the file where u like.

it 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?)