A source for the runtime is available, by the way, if you really want to go deeper.
Shortly speaking; method names β their selectors β are stored as C strings in the binary traversal poppy. That is, if you have a method -(void)foo:(int)a bar:(int)b; , in mach-o there will be a selector line foo:bar:
Type encoding information is also stored in another segment of the mach-o file. This type information β for which there is an API in the runtime to retrieve it β describes the return type and arguments to the method.
Please note that type information is incomplete. Also note that using type information to determine how to generally encode / decode arguments and return a value from a method is a direct pain.
source share