Technicality: you can have as many main
functions as you want in a C++ program, but only one with extern linkage in the global namespace.
If you want multiple entry points in a C++ program, the simplest is probably to use a command line argument, and have the primary main
dispatch to other startup functions based on the argument.
One alternative is to build multiple executables, one for each startup function you want. You can select the startup function by linking with an object code file with that startup function. Or you can use preprocessor directives to conditionally include only the relevant definition of main
for each build.
Another alternative, which however is system-specific, is to create a Windows DLL with multiple exported functions. A 32-bit such DLL can then be run via the rundll32.exe
standard Windows program.