User Tools

Site Tools


tplglobalrebaseinstructions.htm
Navigation:  Templates > Guide to all Templates > Extension Templates >====== Set DLL Image Base Memory Address ====== Previous pageReturn to chapter overviewNext page

This template extension allows you to rebase your application's DLLs. Rebasing is a technique used to modify the base memory address of your DLL.

The base address of a DLL is the preferred location in your application's virtual memory address space where the loader attempts to place the DLL. It is generally specified at link time and used by the linker to write address pointers into the DLL binary . If a DLL cannot load at its preferred base address because the memory region required is already occupied, the loader relocates the DLL elsewhere in virtual memory, then updates all of the address pointers in the DLL to adjust them for the new base address. Making these changes can be time consuming, because the image must be copied to the page file and modified for the new address. This also consumes page file memory until the application is closed and results in the DLL not being shared. A properly based DLL can be demand loaded from disk, so it consumes no page file memory and can be shared. If you have a large application that uses many DLLs, it is important for each DLL to have a different base address to minimize load time and memory use.

It is best to base DLLs from the top of the address range down, instead of from the bottom up. Dynamic memory is allocated from the bottom up and if a DLL tries to load where dynamic memory has been allocated, it will be relocated, just as if a DLL was loaded at that address.

This template is only valid for applications that use DLL as their target output type. EXE and LIB target types are not affected by this template.

Choose from the following prompts:

Select method

Choose Specify manually, if you would like to manually assign the DLL's new Image Base Address, or Choose from list to provide a valid set of choices to choose from.

Manual Address

This tab contriol allows you to specify a manual image base memory address for your target DLL.

DLL Base Address in hex

Enter an eight digit memory base address in hexadecimal format.

The DLL Base Address must be between 02000000 and 6FFF0000 and end with 0000.

Your EXE and the Clarion libraries use addresses 00400000 to 02000000, so this template will prevent you from using any address below 02000000

Use a Process viewer (like Dependency Walker) to verify that your address space as no conflicts. If you do cause a conflict, the Windows loader will resolve it for you automatically.

IMAGE_BASE ########h will be added to the Export file with the address specified if the target file is a DLL.

Choose Address

This tab control allows you to select a memory address from a list of image base memory addresses to use for your target DLL.

DLL Base Address in hex

Enter an eight digit memory base address in hexadecimal format.

Select a different base address for each DLL you use in your application.

The listed addresses are on 1 MB boundaries and should allow room for large DLLs. If your DLLs are over 1 MB in size, then skip an address to allow more room.

Use a Process viewer (like Dependency Walker) to verify that your address space as no conflicts. If you do cause a conflict, the Windows loader will resolve it for you automatically.

IMAGE_BASE ########h will be added to the Export file with the address specified, if the target file is a DLL.

tplglobalrebaseinstructions.htm.txt · Last modified: 2021/04/15 15:57 (external edit)