I want to make a dummy Win32 EXE file that is much larger than it should be. So by default a boiler plate Win32 EXE file is 80 KB. I want a 5 MB one for testing some other utilities.
The first idea is to add a resource, but as it turns out embedded resources are not the same as 5 MB of code when it comes to memory allocation. I am thinking I can reference a large library and end up with a huge EXE file? If not, perhaps scripting a few thousand similar methods like AddNum1, AddNum2, etc., etc.?
Any simple ideas are very appreciated.
Use a big array of constant data, like explicit strings:
Unlike variable data, constant data often falls in the same memory section as the actual code, although this may be compiler- or linker-dependent.
Edit: I tested the following and it works on Linux:
Both this code and its output compile cleanly.