Is there a C ++ equivalent (or equivalent method) of the Perl __DATA__ segment?

Does anyone know the C ++ equivalent of the Perl __DATA__ segment? For those unfamiliar with Perl, the __DATA__ segment is an (optional) annotation at the end of the Perl file; everything that comes after is considered the contents of the (virtual) file, which can be accessed (read, written) by Perl through the DATA file descriptor. I am looking for something like this for use in a C ++ program (don't ask, don't say).

thanks

+4
source share
1 answer

There is nothing like this in general.

However, the Linux ELF binary format allows you to include data files through the GNU objcopy .

On Windows, you can use resource files and designate a linker to include in the executable.

OS X typically uses application packages to achieve a similar effect.

+8
source

Source: https://habr.com/ru/post/1500743/


All Articles