ANONYMOUS wrote:
The ml doesn't need a main because it's not being compiled. It's the temporary C file being compiled which will need a main like every C program.
right, I understand that the temporary C files can just be encapsulated like so (correct me if i'm wrong):
int main(int argc, char *argv[]) {
// converted c code here
}
but that doesn't really explain how the program can access the arguments, as we don't know what the program is going to refer the argument values as when doing the computing, so we cant really name the main parameters argc and argv right?
unless i'm missing something and it says how the arguments is going to be used in the ml file
You are missing something.
You replace the identifiers (in the ml file) arg0, arg1, arg2, etc. By the command line arguments that are passed to run ml. e.g.
./runml somefile.ml 1 2 3
means that in the ml file the parameters will be initialized as follows.
arg0 = 1
arg1 = 2
arg2 = 3