It's the linker that handles all that. The compiler just emits a special sequence in the object file saying "I have this external symbol func, please resolve it" for the linker. Then linker sees that, and searches all other object files and libraries for the symbol.