[fpc-devel]FPC 1.0.8 - dont load many DLL

Pierre Muller pierre at freepascal.org
Thu Jun 12 17:17:56 CEST 2003


At 16:59 12/06/2003, Peter Vreman wrote:
>At 08:55 12-6-2003, you wrote:
>>Hi,
>>I download new version FPC 1.0.8 (05-06-2003)   from FTP for Win32.
>>I need use FPC to create DLL for Win32 system and load many DLL in one
>>apllication.
>>
>>And I have problem, because only fist DLL is load correctly. Next DLL I cant
>>load.
>>What is wrong? Is any workaround thhis problem.
>>
>>I attach example code, two DLL's  and one application.
>>Eatch DLL creates log file and write to file "dllx.log" text  "DLLx is
>>loaded."
>>Sample DLL have names "Dll1.pas" and "DLL2.pas"
>>Sample program have name "testDLL.pas"
>>
>>When I compile this program use Delphi, both DLL load correctly.
>>Any sugestions?
>
>Here is no problem:
>
>C:\down>testdll
>DLL1 is loaded
>DLL2 is loaded
I suspect that your problem does copme from some 
options that you use (options that might be hidden in your config file).

By default all generated DLL get the same Image Base 0x10000000.
Thus to be able to load two DLL compiled without specifying 
the ImageBase, you will need to generate relocatable DLLs.

In order to get a relocatable DLL, you need to use -WR option,
which is incompatible with debugging information
(because the relocation process tried to relocate some values
in the debugging sections, but fails to do that correctly
and changes the relocation section itself..
leading to an unsuable DLL).

The other solution is to specify explicitly another ImageBase 
for the second DLL using 
-WB11000000 for instance.





More information about the fpc-devel mailing list