[fpc-devel] Fix for an annoying error

J. Gareth Moreton gareth at moreton-family.com
Tue Nov 30 08:33:28 CET 2021

Hi everyone,

For a while now I've had problems building the i386-win32 compiler under 
my 64-bit Windows system because one of the packages fails to build - 
this is because it thinks a statically-imported DLL (done through 
$linklib) is invalid. Technically it is, but this system DLL (for me, it 
is named COMMON.DLL and is in one of my system folders, so it's not 
something I can safely modify or replace) is for 64-bit Windows and is 
not recognised when building for 32-bit, and the only 'fix' is to 
comment out the culprit $linklib line in the package source.

I've submitted a merge request that generates a warning instead of an 
error if it detects the DLL is 64-bit for a 32-bit target and vice 
versa.  The checks, however, are very strict (it checks the COFF magic 
number, which contains a platform target, and the size of the optional 
header), and an error is still thrown if the DLL is actually corrupted 
or is for an unknown target.

A warning is still thrown because the program that uses it may 
malfunction, and might be indicative of a bug or a faulty search path 
for the DLL.


Gareth aka. Kit

This email has been checked for viruses by Avast antivirus software.

More information about the fpc-devel mailing list