How to save module with external codegen as .so or .dll

@comaniac do you have any example code here? I just want to make sure I’m not doing anything silly.