Archived

This topic is now archived and is closed to further replies.

Raab314159

Do you know *exactly* what's a DLL?

Recommended Posts

The basic idea goes like this...

At program load, load all .dll files into memory that are required (if they aren''t already loaded). It gets all the function locations in the .dll and adds the .dll''s base address to that, so you now know the actual memory address of said function. So, when you call the function, it does a normal function call to the memory address of the function. If a .dll is sitting in ram, and hasn''t been used in a while, it will get swapped to the disk, and the operating system keeps track of which is in memory and in a swap file. If the program makes a call to a function that''s in swap, it generates a general protection fault, which would call the OS''s memory manager saying that it tried to access a memory location that was swapped to hard drive. The memory manager would then put it back into ram, and return from the interrupt and allow the program to keep going. I also assume it keeps a list of currently loaded .dll files, that way it only loads each one once, so if it''s not loaded, it loads it.. if it is, it just gives you the address of it in memory.

Share this post


Link to post
Share on other sites