| ▲ | mikesolar0819 3 days ago | |||||||
I recently rewrote a complex C++ program into Rust using the Strangler Mode, all codes are written by AI. Firstly, I split the code into some dynamic libraries, which uses C ABI to interacts with each other. Secondly, rewrite the libraries one by one. A init_xxx function are used to construct a object and a free_xxx is used to deconstruct it. A handle is used as 'this' pointer. In the caller side, write another class, constructor calls init_xxx and deconstructor calls free_xxx. No other code should be modified during the split. | ||||||||
| ▲ | aka-rider 3 days ago | parent [-] | |||||||
Nice. Yeah, the general problem is how to divide and conquer. Your method is not always available (it depends on the language pair), in my case, Go packages didn't translate into Rust crates 1:1. | ||||||||
| ||||||||