VBA could store some data by simply putting those data into Excel cells or Powerpoint TextBoxes, which is kinda counterintuitive for a programming language to have persist value storage even after stopped running, though perfectly reasonable. Could we do similar thing in the magical C++? This heavily platform dependent toy (ELF + POSIX) achieves this.
It simply utilizes the .data
segment by either specifying some variables to be put there, or just utilize the fact that initialized values are put there. Some magical operations used:
- The variables
__data_start
andedata
provided by linker scripts - Read output of
awk
withpopen
MIT License