DllImport: How to specify the library to link to?

I am absolutely new to LLVM. Currently reading through documentation and the C-API (which i want to use). As i am working on Windows, i was curios on how to specify an import which links to a function exported by a dll. The DLLStorageClass seems to be the wy to go, this seems clear. But after declaring a function for import, how do i specify the DLL the function is included in?

You don’t specify that at the LLVM layer. Instead, the linker is told which dll you want the import to resolve against by specifying a .lib file as a linker input.

Thank you.
So as far as i can see the C-API can merge/optimize/output modules to native objectfiles. And linking must be done using lld for example? By reading your answer and the lld page i have the following question:

  • instead of a .lib file i can use a .dll, right? (your answer implied only .lib)
  • if i have MyLibA.dll and MyLibB.dll and both export FooA and FooB but i want to import FooA from MyLibA and FooB from MyLibB.dll, do i have to declare the imports in 2 different llvmmodules for linking?

Is there some document or something to read further? I don’t want to nuke everybody here with every single question i might have.