:orphan: .. _ZE_extension_linkage_inspection: ====================================== Linkage Inspection Extension ====================================== API ---- * Functions * :ref:`zeModuleInspectLinkageExt` * Enumerations * :ref:`ze-linkage-inspection-ext-version-t` * :ref:`ze-linkage-inspection-ext-flags-t` * Structures * :ref:`ze-linkage-inspection-ext-desc-t` Linkage Inspection ~~~~~~~~~~~~~~~~~~ Modules support SPIR-V linkage, i.e., modules can import and export global variables and function definitions to/from other modules. This extension provides an API to inspect the linkage properties & requirements of a collection of modules. Modules may require global variables & functions to be imported before all dependencies are satisfied. Modules may also export global variables & functions that can be imported by dependent modules. Additionally, a set of modules may have un-satisfiable import dependencies, i.e., import dependencies that are required by one or modules in the set that are not provided as exports by any other module within the set. If the set of modules is to be dynamically linked using :ref:`zeModuleDynamicLink`\, all un-resolvable import dependencies must be eliminated from the set by adding modules to the set that define the missing import dependencies. The ze_module_build_log_handle_t log object returned by the call to :ref:`zeModuleInspectLinkageExt` will contain separate lists of the imports, un-resolvable imports, & exports requested via the appropriate combination of :ref:`ze-linkage-inspection-ext-flags-t` flags. The following psuedo-code demonstrates a sequence for inspecting the import dependencies, un-resolvable import dependencies, and exports of a set of modules: .. parsed-literal:: ... // Create a linkage inspection descriptor :ref:`ze-linkage-inspection-ext-desc-t` inspectDesc = {:ref:`ZE_STRUCTURE_TYPE_LINKAGE_INSPECTION_EXT_DESC `\, nullptr, :ref:`ZE_LINKAGE_INSPECTION_EXT_FLAG_IMPORTS ` | :ref:`ZE_LINKAGE_INSPECTION_EXT_FLAG_UNRESOLVABLE_IMPORTS ` | :ref:`ZE_LINKAGE_INSPECTION_EXT_FLAG_EXPORTS ` }; ze_module_build_log_handle_t linkLog; :ref:`ze-result-t` result = :ref:`zeModuleInspectLinkageExt`\(&inspectDesc, numModules, &hModules, &linkLog); size_t szLog = 0; :ref:`zeModuleBuildLogGetString`\(linkLog, &szLog, nullptr); char_t* strLog = allocate(szLog); :ref:`zeModuleBuildLogGetString`\(linkLog, &szLog, strLog); // Save log to disk. ... free(strLog); :ref:`zeModuleBuildLogDestroy`\(linkLog);