Hot reloading Code and Callbacks
1 month ago
on May 3, 2020, 8:17 a.m.
Reason: Initial post
I implemented Casey's DLL-hot reloading system and it works great.
However, I am not sure how to handle callback functions properly. For example, say we have a job, which goes on over multiple frames, like asynchronously loading an asset. I would like to get notified when the job is done, so callback functions seem like a good idea. When the DLL gets reloaded in the meantime though, the function pointer gets invalidated.
Am I missing an obvious alternative to callback functions?
As far as I understand in Handmade Hero, jobs are never spanning multiple frames, so callback functions only need to stay valid for one frame. Since the DLL gets reloaded on frame boundaries, there is no problem.
Can someone help me out here? Any help is appreciated.