windowsvisual-studiowinapicom

How do i remove the dependency of oledlg.dll from my DLL


I'm analyzing a DLL using dumpbin and came across the following entry in its imports section:

    oledlg.dll  
              10273CD0 Import Address Table  
              102FB5B0 Import Name Table  
                     0 time date stamp  
                     0 Index of first forwarder reference  

                    3 OleUIBusyW  

I want to remove the dependency of oledlg.dll from my application.

These are the libs in Linker -> Input:

Rpcrt4.lib;msi.lib;shlwapi.lib;Advapi32.lib;odbc32.lib;odbccp32.lib;Version.lib;

I found out oledlg.dll in DelayLoadDLLs section of my vcxproj. I removed it from there and rebuilt the DLL, but i still see it in /imports.

I added /VERBOSE:LIB in my Linker command line and it printed the following information:

5>    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x86\Imm32.Lib:
5>    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x86\WinMM.Lib:
5>    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x86\oledlg.lib:
5>    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x86\urlmon.lib:
5>    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x86\msxml6.lib:

I also searched the "OleUIBusyW" but i don't see it being called anywhere. This dependency on oledlg.dll is causing my application to not work on Windows Server Core since oledlg.dll is not shipped with Server Core.


Solution

  • Set Project Properties -> Linker -> Optimization -> References -> Yes (/OPT:REF)

    This prevents the explicit dependency on oledlg.dll even when not being used.