Difference between load-time dynamic linking and run-time dynamic linking

前端 未结 5 1753
一整个雨季
一整个雨季 2020-12-12 21:04

When loading programs into memory, what is the difference between load-time dynamic linking and run-time dynamic linking?

5条回答
  •  春和景丽
    2020-12-12 21:58

    Load Time premature optimize away the GetProcAddress() by creating a fixed offset from the start of the DLL. Older executables cannot work with newer DLLs violating the Open Principle of SOLID; newer executables cannot work with older DLLs because the function offset may be different so it violates the Close Principle of SOLID. You get DLL-HELL when you violate SOLID.

    Run Time cannot premature optimize away the GetProcAddress() calls. Older executables could work with newer DLLs, but cannot use the new functions adhering to the Close Principle of SOLID; newer executables could work with older DLLs, but cannot use the new functions adhering to the Close Principle of SOLID. The comparison of using older executables with older DLLs, and using newer executables with newer DLLs is the adherence of the Open Principle of SOLID.

    Hot Code Reloading is Object Oriented Programming. You fail Liskov Substitution Principle where the newer DLL cannot be used with an older executable, or where the older DLL cannot be used with a newer executable. Newer versions are inheritance of older versions regardless if they are executables or DLLs.

提交回复
热议问题