Currently I am implementing a compiler for my programming language. So my compiler compiles source files to .o
object files, and since I want my programming language to have access to C functions like printf
, I need link the .o
file to libc
.
To be clear, using g++
or ld
in commandline as the linker works perfectly, but I want to invoke LLVM linker (lld
) using C++. However, after searching through lld
's documentation, I didn't find anything about its C++ API.
For anyone experienced in making a compiler using LLVM, is there a C++ API for lld
? If yes, then how can I use the API or where is its documentation?
I don't want to use things like system()
to call lld