for example, dynamic link libraries (.lib / .so files) are not introduced into the program at all when dynamically linked. So why do we need to give the path to the dynamic link library when we compile dynamically?
for example, dynamic link libraries (.lib / .so files) are not introduced into the program at all when dynamically linked. So why do we need to give the path to the dynamic link library when we compile dynamically?
dynamic link is determined at run time, so you don't need to use the address of the function in the dynamic link library during the compile link phase. The reason why we need to introduce the dynamic link library in the compile connection phase is to determine the symbol name to connect, so that we can find the corresponding function entry according to the symbol name at run time.
you may not even have a dynamic library at compile time, but the program will die at run time because it cannot find the dynamic library.
We always need to know where the address of the called function is.