If you want an analogy with a modern system, when you executed a command
command_name arg1 arg2 arg3 ...
The shell (called "command processor" on Multics) would perform the rough equivalent of this on Unix:
- Parse the arguments into an array of strings.
- find the
command_name
file using the search path.
- Open it using
dlopen()
- Get a pointer to the function using
dlsym("command_name")
- Call the function with the above argument array.
So it's not too different from the way Unix execvp()
works. The significant differences are that it's not restricted to calling the main()
function, and there's no fork()
before loading and executing the program (on Multics, new processes were generally only created when logging in -- the entire login session is one big process with programs executed as subroutines).
Notice that this can only be used to pass string arguments. There's a command (whose name escapes me) that could be used to call arbitrary procedures. In the argument list you used options to specify the datatype of each argument, something like:
proc_call name -fixed_dec 123 -char abc -output fix_dec
This would parse the arguments, then use a process similar to the above to call the function with that argument list.