recently I've stumbled upon this post: Get a function declaration from another llvm::Module
In the comments, @arrowd says something about getGlobalContext(). I am very interested in finding more about this function, because I want to create LLVM types without depending on a context (a context is scoped to a module and I'm working with multiple modules). I've tried to look up this function in the LLVM docs, but I can't find it (https://llvm.org/doxygen/classllvm_1_1LLVMContext.html). Does anyone know if such function still exists? The first post I've linked was made more than 10 years ago so LLVM creators probably have made some changes to the c++ API. if such function doesn't exist anymore, how can I get the global context?
This is an annoying issue because when I'm calling an imported function, the types seem to be correct but the contexts don't match up, which results in very weird errors. for example calling a function that takes an i32 with a 32 bit int results in an error:
Call parameter type does not match function signature!
i32 4
i32 call void @cool_function(i32 4)