Hello,
Regarding DLL base address:
1) What does it mean?
A base address for a DLL is the virtual memory address into which it gets
loaded by default.
If I simplify things somewhat, all 32-bit Windows applications have a 2GB
memory space. When your application starts, this virtual memory space is
created by the operating system (OS), and it is virtual in a sense that
multiple processes can inside their address space refer to memory locations
with the same addresses, but the OS makes sure there are no actual
collisions.
Now, every EXE needs one or more DLLs, often the count can be something in
the range of 30-50 DLLs, most of which are OS DLLs. Each of these DLLs has a
base address, which, as I mentioned is the memory address into which it gets
loaded by default. Since two DLLs cannot be loaded into the same address,
the OS much "rebase" the DLL that is loaded if it has the same base address
as another DLL. This is a relatively slow operation.
Matt Pietrek has written an article about this to the May 2000 issue of MSDN
Magazine:
http://msdn.microsoft.com/msdnmag/issues/0500/hood/default.aspx
2) Should it ever be changed?
Since "rebasing" is costly, the answer is in yes, it should be changed.
However, it is arguable whether changing the base address actually has any
(real world) effect in the performance of your application. Sure, the effect
can be measured, but since you cannot know in advance which address would be
"collision-free" (since you can't control the base addresses of all those OS
DLLs), it is often a hit-and-miss thing.
So if you are writing a basic .NET application with one of two DLLs
(libraries), it probably doesn't make any difference to keep the default
values versus to change it. But if you have a big application with dozens of
libraries and performance is critical, consider changing the default values
of all your DLLs to unique values.
3) What are the rules to change it?
See the documentation of the /baseaddress command-line option for the C#
compiler:
http://msdn2.microsoft.com/en-us/library/b1awdekb.aspx
Hope this clarifies the situation.
--
Regards,
Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/