Any pointers on hot code reloading for C++?
In general, though, it's going to be hard.
11–20 of 58 posts
Any pointers on hot code reloading for C++?
In general, though, it's going to be hard.
Having a hot reloaded set up for both my django (It's built in) environment and Web app environment is such a force multiplier. It's not about simply saving time doing it manually. It fundamentally changes my dev-test/experiment workflow. I love being able to tab to a server file, make a change, tab to a client file, make another change, and instantly test it in a browser.
Have you tried PHP? :) I jest, but really I feel like we've made things so complicated it just gets in our way. Our Javascript pipeline is huge, complicated, and requires you to sit down and wrap your head around it every time you want to modify it. If I get to greenfield another project, it's going to be so bloody simple.
They don't resemble traditional websites/CRUD apps a whole lot. Much closer to Sim City + Factorio.
When it comes to making your standard issue website/webapp, I think some of them could stand to be simpler.
Any pointers on hot code reloading for C++?
The examples just have loops where the reloaded function is called in a loop. Is this just updating the definition of the function between calls?
I was always marveled at the capacities of xDebug, and never stopped using it since I found it (Some 10+ years), and honestly, coupling it with PHPStorm is another level.
But still, hitting reload on the browser, or running a script from the CLI gets tiring after the 20th time; so I made this little class where you would call a method, and the method will reload the script where the code was located continuously until I managed to get it to do what I wanted.
It was very Johnny Mnemonic, but it worked.
The in-memory reloading (which may be seen at: https://github.com/fabioz/PyDev.Debugger/blob/main/_pydevd_b...) unfortunately doesn't work all the time (fixing the references at runtime in Python is difficult), but it works well enough for the cases where you have a simple function and change it (that file does explain some of the issues that the reloading faces).
One major issue is that after doing the reload, you need to get out of the function and then back into it to see the difference -- so, if you're stopped in the function in a breakpoint, it's not possible to simply drop the function and restart it as Python itself doesn't support that... maybe that's a good idea for a PEP ;)
Anyways, when it works, it's pretty nice in that you don't have to restart your whole debug session to see changes (the other approach, which webservers use in general is just restart the whole process, so, for instance, Django has an initial process just monitoring for changes and a 2nd process which is actually serving requests which is restarted when something changes -- not as good if you have a heavy startup or are working with something where you have to click through multiple things to get to the state which you want).
Any pointers on hot code reloading for C++?
What are some simple use cases for this?