Is there a way to call the llvm `llc` command from my C project?

298 views Asked by At

I'm trying to use the llc command from llvm in my C compiler project, but I don't know how to use it. I've tried linking llvm libraries in cmake, but I don't know which libraries to link if I want llc. Any help would be fine, thanks!

1

There are 1 answers

8
Emily-TTG On

Now it kind of depends on the OS, but yes there are ways to open a subprocess through the system shell

Under UNIX-y systems you can use popen (https://linux.die.net/man/3/popen), which allows you to open and communicate with a subprocess (in this case llc).

Under Windows it seems like _popen has similar functionality - though I've never personally used it so you may need to read the MSDN