Home > Software design >  Is there a C/C APIfor pkg-config?
Is there a C/C APIfor pkg-config?

Time:12-05

I have a strange use case. I have a C program that compiles a library object and dynamically loads it at runtime. The library it compiles depends on a third party dependency, which so far I have been solving by manually hard coding the path and changing it when I switch computers.

Is there a way to call pkg-config from C to ask it if a library is installed and where? I know I could call it from a bash session and parse the output, but this is not what I want, I would like to call it directly instead of invoking a shell if that is possible.

CodePudding user response:

Is there a C/C APIfor pkg-config?

Yes, there is a C api. https://github.com/pkgconf/pkgconf/blob/master/libpkgconf/libpkgconf.h , which should get installed with libpkgconf.so shared library.

  • Related