Greetings all
How can i create an executable in run-time? (win32). i need a simple wrapper for different console commands. this is because i must have executable there is no way around it. so what i have come up with is passing the command that i want executed as a command line parameter and it will create an executable that will execute those commands upon execution. I know this is possible because i have seen it being used. How can i do this?
If any one could explain this to me or refer me to any kind of helpful documentation, it would be greatly appreciated.

Example: "g++ -o out.a main.cpp"
If you want that to be executed inside a C or C++ program: system("g++ -o out.a main.cpp");

Write an assembler, allocate some space and run the output as a function.

the thing is that i want it to give me an executable not a function. now i was thinking to write to creat the exe first save it as a resource then get the input for the command from the command line then have that command replace the simple exe with the system() function.

int main()
	system("dummy text afgfdhhgfhjjg");

1. Compile this
2. Searching the executable for the string literal and note the offset
3. Use a binary fstream to overwrite that section in the executable producing executable.
4. Hope that overwriting with a larger string won't go over anything important.