Currently I’m playing around with LLVM and am implementing my own toy compiler and programming language. Are there any good tutorials or examples on how I can call external library functions (e.g. from libc or whatever) from the IR decomposition of my own language?
Cheers
You’ll need to declare the functions you want to call in the LLVM IR. If you don’t provide a body for a function, it works just like a declaration in C. You’re probably aware of this, but the linker only checks the function name, not the type. Make sure you match the types up in the declaration or you’ll get some strange results and no warnings.