-
multiple main functions
hi,
i was perusing some source code today and came across multiple main functions in two separate files.
I was wondering how this is possible. Does anybody know of a place I could read more on this.
Just a curious okie. Any type of feedback is most welcome.
-
The only likely scenario is that these two files are not forming into one executable, or the main functions are somehow either renamed using macros, or within conditionaly compiled code.
You can not have two functions by the same name in the same executable. main is not special here, it applies to ALL functions.
--
Mats
-
one main writes a save
well from what i have gathered the one main function is for executing the main prog, while the other main is for writing a save file.
Can I ask another question, purely hypothetical as I am not that clued up on the subject,
but have read some articles on the topic,
Is it possible to wrap C code within python, and thus run two main functions from two separate portions of source.
Or run one C prog that executes another C prog.
Thanks for the information, anyhow.
-
Yes, you can use python to run other programs (or use C to extend python, if you wish to do that, but that requires some special coding to match the Pything interface), and you can use C to start another program if you wish. How you go about these things will depend quite a lot on what you want to achieve and which OS you are using.
--
Mats