<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59669>59669</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Unresolved External Symbol
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          HideakiAtsuyo
      </td>
    </tr>
</table>

<pre>
    Hello, I want to compile a simple cpp file using `SysAllocateString` from `oleaut32` but I can't find how to link this lib

The commands I'm using to compile:
```
clang++ -c -o dllCode.o dllCode.cpp -v
clang++ -shared -v -o US_Rtm.dll dllCode.o
```

Error: `error LNK2019: unresolved external symbol __imp_SysAllocString referenced in function GS`



<details>
  <summary> Full Logs </summary>

```
clang version 15.0.6
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
 (in-process)
 "C:\\Program Files\\LLVM\\bin\\clang++.exe" -cc1 -triple x86_64-pc-windows-msvc19.35.32019 -emit-obj -mrelax-all -mincremental-linker-compatible --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name dllCode.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -v "-fcoverage-compilation-dir=C:\\Users\\Hide\\Desktop\\Development\\VisualStudio\\UnmanagedStringsWithDLLV2\\Release" -resource-dir "C:\\Program Files\\LLVM\\lib\\clang\\15.0.6" -internal-isystem "C:\\Program Files\\LLVM\\lib\\clang\\15.0.6\\include" -internal-isystem "C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.35.32019\\include" -internal-isystem "C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.35.32019\\atlmfc\\include" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\ucrt" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\shared" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\um" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\winrt" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\cppwinrt" -fdeprecated-macro "-fdebug-compilation-dir=C:\\Users\\Hide\\Desktop\\Development\\VisualStudio\\UnmanagedStringsWithDLLV2\\Release" -ferror-limit 19 -fmessage-length=120 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.35.32019 -std=c++14 -fdelayed-template-parsing -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -o dllCode.o -x c++ dllCode.cpp
clang -cc1 version 15.0.6 based upon LLVM 15.0.6 default target x86_64-pc-windows-msvc
#include "..." search starts here:
#include <...> search starts here:
 C:\Program Files\LLVM\lib\clang\15.0.6\include
 C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32019\include
 C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32019\atlmfc\include
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt
End of search list.
clang version 15.0.6
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
 "C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.35.32019\\bin\\Hostx64\\x64\\link.exe" -out:US_Rtm.dll -defaultlib:libcmt -defaultlib:oldnames "-libpath:C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.35.32019\\lib\\x64" "-libpath:C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.35.32019\\atlmfc\\lib\\x64" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.22621.0\\ucrt\\x64" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.22621.0\\um\\x64" "-libpath:C:\\Program Files\\LLVM\\lib\\clang\\15.0.6\\lib\\windows" -nologo -dll -implib:US_Rtm.lib dllCode.o
   Creating library US_Rtm.lib and object US_Rtm.exp
dllCode.o : error LNK2019: unresolved external symbol __imp_SysAllocString referenced in function GS
US_Rtm.dll : fatal error LNK1120: 1 unresolved externals
clang++: error: linker command failed with exit code 1120 (use -v to see invocation)
```

\==========
</details>

<details>
 <summary> GS Function Screenshot </summary>

![](https://i.imgur.com/Wm3zW5W.png)

No this function will not stay like this, waiting to get this compiling & working before doing the necessary modifications.
\==========
</details>

Thanks for your time !
Regards.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUWFlz2zgS_jX0SxdYImjJ1oMeHCmepMYztRXneEyBQJPCGAcLAHXsr99qkjrsdTKz2fE6W6WSwCbU3ejj60aLGHXjEBfZ9E02XV2ILq19WLzTCsWDvkmx2_uLyqv94h0a4zO-hPewFS5B8iC9bbVBEBC1bQ2CbFuoidJF7RrIZpP7fbwxxkuR8D4F7ZpsNoE6eEsvvUHRpZITreoSvAcpXMavEtTaKVj7LUkx2j1AWusIRlfZZJVNbobvj2skFaxwKsL7jF_ZUe5Jtawc92azyfjpH6URrsn4m4y_ASaBeVDGLL3C_LSiw7DNM_vjWgRUwDb0v0_3Xz8kmytjTiyeFTl8vw3Bh6y8oeMjreHu91_5pJgTrXMBozcbVIC7hMEJA3FvK2_g61dt268Haw6mhIA1BnQSFWgHd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