Load oleaut32.dll for widestrings on demand.
Same as !449 (merged) but more dubious because it targets a narrow range of applications.
widestring
on Windows is an UTF-16 string type managed with oleaut32.dll
calls and required solely to exchange BSTR
s with COM APIs; using it in other scenarios instead of unicodestring
is a legacy artefact. (Whether widestring
s in variant
s are “COM interaction” or “legacy artefacts” is up to the reader.)
All but the simplest applications load oleaut32.dll
anyway (often indirectly), however I think that respecting simplest applications is a good thing. (The other time, the FPC itself could be among these applications if not one ole32.dll:CoTaskMemFree
...) More substantial proof of viability: Windows libraries themselves do the equivalent of what I propose, for example, my winmm.dll
delay-loads oleaut32.dll
(according to the Dependency Walker) roughly for the same functions (SysAllocString
, SysFreeString
), to never load in simple scenarios.