In my case I was able to significantly reduce DLL size by changing compilation method and IDE.
First I tried to compile using Cmake
in CLion
IDE and the DLL size was always above 2 MB
.
Then I compiled the same code using default settings in Visual Studio 2022
and I was able to reduce DLL size to 11 KB
.