Question

I'm a CS student, and I'm doing a project on shared libraries and dynamic linking/loading. One of the questions I have to answer is how symbols are resolved with dynamic linking/loading. I've scoured the internet and haven't been able to find anything conclusive. I understand different linkers may resolve symbols differently across different operating systems. I'm just looking for a general, windows-based answer; how are symbols resolved in dynamic linking and loading?

Thank You!

Was it helpful?

Solution

how are symbols resolved in dynamic linking and loading?

It is not really any different than how this is done during compilation and linking.

The actual machine code for references to dynamically loaded imports may be somewhat different than the code generated for statically resolved imports — the linker may insert a small thunk for references from code that will be dynamically resolved — however, the actual resolution mechanism isn't really different.

An executable file format, which is typically used for both program files and object files, has sections for symbol names, imports, exports, and relocations records for references.

Imports in one file are matched to exports in other files to find a symbol's address, and then, relocation records for the imports are applied to fix up actual references from code and data to those symbols.

Licensed under: CC-BY-SA with attribution
scroll top