To the best of my understanding, this would take a bit of effort, but should be quite doable for someone with the right skillset — you’ll need some familiarity with name mangling, how linkers work, and that sort of low-level stuff. And you’ll also need to write some Rust code that interacts with the Tectonic crate (whose API is, unfortunately and ironically, hardly documented).
I believe the “best” approach would be to create a Rust “cdylib” or “staticlib” crate that exported the API that you needed in a C-compatible way: using static, public
no_mangle Rust functions. You could then use rust-genbind to create a C header file that represents this API, and finally invoke that from your C++ code. So, this would involve several layers, but depending on your use case all of those layers might be exporting a single function call.
One wrinkle might be that Tectonic emits XeTeX-style “XDV” files, not traditional DVI files, and the only thing it can currently do with such files is convert them into PDF files. So you might need to bundle another tool that converts the XDVs to whatever image format you prefer.
It would be great to have an example of how to bundle Tectonic in this way, since certainly not every end-user is going to want or be able to write their upper layers in Rust. So, if you get the chance to write some code along these lines, please keep us informed of how it goes!