By default, Free Pascal (actually, the linker used by Free Pascal) creates libraries that are not
relocatable. This means that they must be loaded at a xed address in memory: this address is
called the ImageBase address. If two Free Pascal generated libraries are loaded by a program, there
will be a con ict, because the rst librarie already occupies the memory location where the second
library should be loaded.
There are 2 switches in Free Pascal which control the generation of shared libraries under
Windows:
-
-WR
- Generate a relocatable library. This library can be moved to another location in
memory if the ImageBase address it wants is already in use.
-
-WB
- Specify the ImageBase address for the generated library. The standard ImageBase
used by Free Pascal is 0x10000000. This switch allows to change that by specifying
another address, for instance -WB11000000.
The rst option is preferred, as a program may load many libraries present on the system, and they
could already be using the ImageBase address. The second option is faster, as no relocation needs
to be done if the ImageBase address is not yet in use.