473,408 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

What is DLL base address

Hi

Regarding DLL base address:

1) What does it mean?

2) Should it ever be changed?

3) What are the rules to change it?

It defaults to &H00400000.

Regards

Newish

Oct 7 '06 #1
3 8417
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/is...d/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
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Oct 7 '06 #2
1) This is the memory address it will attempt to load in first.
2) Not so much in .NET (this group), but there are definitely reasons to
change in traditional VB, where having each DLL at a different address will
reduce start up time of the app as it does not spend the time finding a good
address to store the DLL in memory.
3) If you are in VB 6, I would always change it. I do not have rules in
front of me (offline at the time I am typing this), but it should be easy
enough to find a base address project still and download (codeplanet.com is
where I think I have seen one).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com/

*************************************************
Think Outside the Box!
*************************************************
"Newish" <ah*******@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
Hi

Regarding DLL base address:

1) What does it mean?

2) Should it ever be changed?

3) What are the rules to change it?

It defaults to &H00400000.

Regards

Newish

Oct 8 '06 #3
jani:

You are correct for unmanaged stuff but this is not the case with JIT
compiled code.

The situation will also arise if you are using ngen .. but again rebasing is
not a major concern with JIT compiled code.

Cheers,

Greg
"Jani Järvinen [MVP]" <ja***@removethis.dystopia.fiwrote in message
news:eW**************@TK2MSFTNGP02.phx.gbl...
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/is...d/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
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/


Oct 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Dario | last post by:
The following simple program behaves differently in Windows and Linux . #include <stdexcept> #include <iostream> #include <string> using namespace std; class LogicError : public logic_error {...
6
by: todd smith | last post by:
If i have the following class hierarchy: class Base : { virtual void foo(); }; class Derived : public Base { void foo();
51
by: jacob navia | last post by:
I would like to add at the beginning of the C tutorial I am writing a short blurb about what "types" are. I came up with the following text. Please can you comment? Did I miss something? Is...
9
by: AtariPete | last post by:
Hi all, My scenario is as follows: * Receive a base 1 array (index starts at 1 instead of 0) of data from a COM component . * Need to pass this array to a .net component that requires its...
1
by: Lee | last post by:
Is there a tool that I can use that will help me decide the optimum place(s) to set the DLL base address for my project, especially if there are several in the project?
0
by: robert | last post by:
Hi all, I'm having a hard time resolving a namespace issue in my wsdl. Here's an element that explains my question, with the full wsdl below: <definitions name="MaragatoService"...
5
by: Michael | last post by:
Hi, Could you tell me whether the following two statement are the same? Derived class is derived from Base class. 1. Base* ptr1; 2. Derived * ptr2; Does it mean ptr1 is the same as ptr2?
7
by: Yen Kwoon | last post by:
Note: This problem is related to gcc but after some back and forth in group gnu.gcc.help it seems to have morph into more of a c++ specificiation question, hence the transplanting to this group. ...
0
by: =?Utf-8?B?Zmplcm9uaW1v?= | last post by:
Hi all, As I mentioned in a previous thread (see 'Dbghelp, symbols and templates' in microsoft.public.windbg), we created a powerful symbol engine using dbghelp to dump the contents of the stack...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.