[llvm] [ORC] Add AutoImportGenerator for COFF dllimport auto-import (PR #203914)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 29 03:44:11 PDT 2026
================
@@ -877,6 +877,43 @@ example, to expose an allowed set of symbols from the main process:
// and contained in the list.
CompileLayer.add(JD, loadModule(...));
+On Windows/COFF targets, calls to dllimport functions are emitted as indirect
+calls through an ``__imp_`` *import address table* (IAT) slot, and even direct
+calls to library functions are expected to bind to a thunk supplied by an import
+library. ORC provides the ``AutoImportGenerator`` utility to synthesize these on
+demand from a dynamic library, so that COFF objects can be JIT-linked without
+building import libraries. The generator is bound to a single DLL: that DLL's
+export table is the authority on what may be synthesized, so a reference to a
+symbol the DLL does not export remains unresolved and the link fails, exactly as
+a static link against the corresponding import library would.
+
+ .. code-block:: c++
+
+ auto &JD = ES.createJITDylib("main");
+
+ if (auto AIGOrErr =
+ AutoImportGenerator::Load(ES, ObjLinkingLayer, "/path/to/lib.dll"))
----------------
mkovacevic99 wrote:
right, thanks for the catch, I forgot to update it after previous version
https://github.com/llvm/llvm-project/pull/203914
More information about the llvm-commits
mailing list