Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a C++ equivalent (or equivalent technique) of Perl's __DATA__ segment?

is anyone aware of a C++ equivalent of Perl's __DATA__ segment? For anyone not familiar with Perl, the __DATA__ segment is an (optional) annotation towards the end of a Perl file; whatever comes after is considered the content of a (virtual) file which can be accessed (read, written) by Perl through the DATA file handle. I'm looking for something similar to use in a C++ program (don't ask, don't tell).

Thanks

like image 718
tunnuz Avatar asked Feb 15 '23 08:02

tunnuz


1 Answers

There’s nothing like that in general.

However, the Linux ELF binary format allows the inclusion of data files via the GNU tool objcopy.

On Windows you can use resource files and assign the linker to include those in the executable.

OS X conventionally uses application bundles to achieve a similar effect.

like image 82
Konrad Rudolph Avatar answered Feb 17 '23 22:02

Konrad Rudolph