Yosys provides a yosys-config
executable that allows you to build your C/C++ project in the same way and create a loadable plugin or link against the libyosys.so
shared library. libyosys.so
is undocummented, you can build it by running something like make ENABLE_LIBYOSYS=1
.