This question already has an answer here:
I understand what a function selector is and how it is computed:
The first four bytes of the call data for a function call specifies the function to be called. It is the first (left, high-order in big-endian) four bytes of the Keccak-256 (SHA-3) hash of the signature of the function.
However, I fail to see why knowing the selector is important as far as calling the function is concerned. For a loadable dynamic library (
.so on Linux,
.dll on Windows), a list of callable symbols are imported which serves as the entry points to external clients. Isn't there anything like that in EVM bytecode? If not, how does the EVM locate the method given the function selector? Don't the functions exist as separate entities in the compiled bytecode?