<div>Hello!</div><div>I created a new llvm module (<strong>A</strong>) - to create a 'glue' code.</div><div>I want to call some functions from another module (<strong>B</strong>);</div><div>I load module <strong>B</strong> withing the same LLVMContext, and create a function declaration in module A via:</div><div>Â Â auto functionInAnotherModule = ModuleB.getFunction(callableName);</div><div>Â Â auto functionType = functionInAnotherModule->getFunctionType();</div><div>Â Â auto localFunction = llvm::Function::Create(functionType, llvm::GlobalValue::LinkageTypes::ExternalWeakLinkage, callableName, &ModuleA);</div><div>Â </div><div>Â Â Function seems to be copied, together with complex types its using:</div><div>Â Â ; ModuleID = 'JitModule'</div><div>Â Â source_filename = "JitModule"Â Â </div><div>Â Â %struct._EN12RecordStreamE = type { %class.RecordStream }</div><div>Â Â declare extern_weak void @_EN12RecordStream4InitEPTsN18_EN12RecordStreamEEPvv(%struct._EN12RecordStreamE*, i8*)</div><div>Â Â </div><div>Â Â ... But later I'm not able to link in ModuleB to ModuleA using linker.linkInModule(std::move(ModuleB));</div><div>Â Â llvm says: Assertion failed: !(Pair.first != Ty && Pair.second == Ty) && "mapping to a source type",...</div><div>Â </div><div>Â Â Could someone point me what conceptually I did wrong?</div>