Archived

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

Raab314159

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

Recommended Posts

Raab314159    122
Could you describe then what''s happening when a you call a WIN API procedure that''s not in RAM? I assume there''s some paging involved, but other than that, I have no idea... Thanks in advance!

Share this post


Link to post
Share on other sites
Ready4Dis    180
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
C-Junkie    1099
VMs are special little things. Take an OS class when you get to college.

Unless you''re absolutely dying to find out. In which case, read about it for a few months.

Share this post


Link to post
Share on other sites