At its most basic, the equivalent is a char array full of bytes.
On Linux, you can use xxd -i <file> to “compile” files into char arrays, and then bind the arrays to your binary and use, however, composite bytes.
Here is an example from my own makefile code that creates a “resource file” called templates.h containing a bunch of char arrays representing HTML templates:
templates.h: @echo "#ifndef REDACTED_TEMPLATES_H" > templates.h @echo "#define REDACTED_TEMPLATES_H" >> templates.h @echo "// Auto-generated file! Do not modify!" >> templates.h @echo "// NB: arrays are not null-terminated" >> templates.h @echo "// (anonymous namespace used to force internal linkage)" >> templates.h @echo "namespace {" >> templates.h @echo "namespace templates {" >> templates.h @cd templates;\ for i in * ;\ do \ echo "Compiling $$i...";\ xxd -i $$i | sed -e 's/ =/ __attribute__((unused)) =/' >> ../templates.h;\ done;\ cd .. @echo "}" >> templates.h @echo "}" >> templates.h @echo "#endif" >> templates.h
( see also: How best can I programmatically apply `__attribute__ ((not used))` to these automatically generated objects? )
The result looks something like this:
#ifndef REDACTED_TEMPLATES_H #define REDACTED_TEMPLATES_H
Please note that this specific example is optimal when using a resource in only one translation module, but the general approach can be tailored to your needs.
Lightness Races in Orbit Dec 13 2018-12-12T00: 00Z
source share