One place where this is useful is when you want to export a function several times with different names. For example, if we tried to user32 in Delphi, we could export like this:
exports SetWindowTextA, SetWindowTextA name 'SetWindowText';
In your case, although you export the same function several times with the same name and different ordinal values. Why would you want to do that? I see no good reason for this. However, why should the compiler stop you from doing this? This will require a compiler developer to do this, and what happened?
Therefore, I assume that the compiler developer did not implement a block with multiple exports with the same name, because either:
- They did not consider this case, or
- They reviewed this and decided that efforts to block multiple import names would not provide sufficient benefits to justify development costs.
As for what happens when you call GetProcAddress with the name of a function that has been exported several times, the system will return the first exported function whose name matches.
source share