InnoSetup automatically compares the files to see if it needs to be replaced by looking at the version resource in the file.
You should add the RestartReplace flag to the [Files] entry for your DLL (and any other file that might be in memory / locked). From the InnoSetup documentation:
restartreplace
When an existing file needs to be
replaced, and it is in use (locked) by
another running process, Setup will by
default display an error message. This
flag tells Setup to instead register
the file to be replaced the next time
the system is restarted (by calling
MoveFileEx or by creating an entry in
WININIT.INI). When this happens, the
user will be prompted to restart their
computer at the end of the
installation process.
To maintain compatibility with Windows
95/98/Me, long filenames should not be
used on entries with this flag. Only
"8.3" filenames are supported.
(Windows NT platforms do not have this
limitation.)
NOTE: This flag has no effect on
Windows NT platforms if the user does
not have administrative privileges.
Therefore, when using this flag, it is
recommended that you leave the
PrivilegesRequired [Setup] section
directive at the default setting of
admin.