There are few options: library in C (overhead with writing wrappers but very fast, or general wrapper like SWIG), stand-alone program (overhead with running it, and parsing the output), daemon, whereas daemon can, roughly speaking, listen either of on TCP (overhead related with connections), or local socket (only local machine, and depends on the OS), as well as use either well established protocol (REST, ROAP), or your own.