To my understanding, a .o file is the output when you convert a source file to machine code, along with a list of "symbols" which name things like functions and variables.
A .a file is a static library, basically an archive of (unlinked?) object files packed into one file.
A .so file is a shared library, which is a DLL in Windows, which names what sources you want to use, but the .o's themselves are kept externally in the computer until you actually run the program.
An executable is the result of linking a bunch of object files so that all the symbols are defined, and is a runnable file.
My question: For the case where you write a program with all the functions and variables defined and used entirely in one source file, so there is no external linking needed of the .o output, what is the difference between these files? This includes any formatting, size, or performance differences.
Can I run a .o or .a or .so directly? And if I do, is that going to be faster or slower than running an executable?