Open rdaly525 opened 6 years ago
Here's a possible flow:
User dynamically loads a libcoreir-mantle using our current library flow with CoreIRLoadLibrary_mantle(c)
. During this initialization phase, the mantle library calls into Python and runs a function register_coreir_symbols
which populates the namespace with generator and module typegens and generator definitions using the existing libcoreir-python infrastructure from pycoreir. Then, coreir can be run normally by instancing and running generators, and the mantle symbols will correctly resolve into functions that call into Python using libcoreir-python.
Because we're in C++, I think we can just instance generators using our current mechanism provided that the generators we are instancing have a typegen. To do this, we just have to register a library (say mantle) which defines the generators. Then these generator definitions can be used both as typegens and for linking later on.