How to compile module

Viewed 168

I currently have one main applications where parts of which can be "live-patched". Eg. some functions with predefined name and signature can be updated during runtime. Currently, the repatching is performed by this two steps:

  • use std::process::Command to call rustc to compile a cdylib from the source. Each output file has a new name in order to make sure that dlopen does not use the cached old file
  • use libloading to load and run the newly patched function

This is obviously not ideal for a couple of reasons. My question would be if there is a better way to achieve this? Eg do the compilation from within rust.

Additional info:

  • The patch files do not require any external crates
  • The patch files need to be aware of some common lib modules, which do not get live patched
0 Answers
Related