I currently have a project where I'd like to use rust for - yet have one problematic requirement which seems to be incompatible with rust (as far as I know): loading of modules/plugins.
Loading plugins without reverting to a C-level interface at runtime seems to impossible with rust currently. But are there any solutions that kinda work at or before application startup?
Ideas I have come up so far where I don't know if they would be possible or practical (for all of them the requirement of a fixed compiler version per platform would be ok):
- Distributing some compiled yet unlinked form of the modules, and then link them before startup when the combination of modules is known.
- Distributing some kind of intermediate form of compilation units (e.g. something like MIR) and finish compiling/linking at the user side.
- Like the previous two ideas, something I guess would be possible is to just specify the modules required and load them from something like a alternative registry. Yet this would require everything to be available in source form and also place the complete compilation burden on the user (also would require a fair amount of time every time the combination of plugins changes).
I would love to get some feedback on the ideas or alternative suggestions how to approach this requirement with rust.