Fog Creek Software
Discussion Board

DLL Base Address suitable incrementor?

Hi guys,

What would be a suitable incremental step for DLL base addresses.

I am working on a build process for VB apps and want to increment the base address...

My first guess is to start at VB's default: &H11000000 and increment by 1MB each time (adding &H100000) which should leave enough space.

Does anyone think this is a dumb idea?

Tim H
Monday, December 22, 2003

I thought the only impact of leaving it at the default is a slightly longer load time (for the first use of the dll) - wouldn't have thought it was even measurable ...

though if it turns out it is - I'll stick it in my build tool too ...

Monday, December 22, 2003

You want to use the command-line tool named REBASE.EXE that comes with both VisualStudio and the Platform SDK.

This is the rebasing solution you want to use for all your projects.

First.. read the following link for the background info on REBASE.EXE

In general you want to run the following as one of the last build steps AFTER your dlls have been built (usually from batch file or part of makefile script).

REBASE -b 0x68000000 -d -C coffbase.log -l rebase.log -v file1.dll file2.dll file3.dll … fileN.dll

coffbase.log will contain a summary of the rebasing of each dll
rebase.log will contain a copy of all rebase program output

WIN32 Loader Wizard
Monday, December 22, 2003

Thanks Win32 Loader Wizard! You're the man!

Tim H
Monday, December 22, 2003

Your welcome!

Heston Holtmann; aka WIN32 Loader Wizard
Monday, December 22, 2003

You want to get a copy of one of John Robbin's Debugging Windows Applications books... current edition is:

He talks a lot about rebasing DLL's. It turns out that if you properly rebase everything, not only do you get faster load times, but if you do get a crash with a Dr. Watson log, it's a LOT easier to figure out where the crash was from the log.

He recommends setting your base address based on the name of your DLL's. So A.dll would be at 100000, B.dll would be at 20000, etc. Makes it easier to figure out what dll should be where, and also helps avoid collisions.

Get the book regardless, it's full of really useful tips, and not just for .NET.

Chris Tavares
Monday, December 22, 2003

While reading about rebasing note that if DLL has to be rebased during load new image will be backed by page file and each new instatnce of the DLL would have own set of pages in the page file. So if your DLLs are used in more then one process at the same time it is more important to avoid rebasing at load time.

Wednesday, December 24, 2003

Any objection to using -base to link.exe instead of rebase?

benson margulies
Sunday, May 9, 2004

*  Recent Topics

*  Fog Creek Home