Interactive Programming in C (2014)

nullprogram.com

90 points by ofalkaed 3 days ago


lkuty - 3 days ago

Tsoding made a video about hot code reloading in C (https://www.youtube.com/watch?v=Y57ruDOwH1g) and also used the same concept in "My Own 3b1b Animation Engine but in C" (https://www.youtube.com/watch?v=RVwuYgXNUCM).

90s_dev - 3 days ago

I did something similar ones as a vs code extension for love2d which I called live2d, so that you could develop your game while it was running. It was incredibly fun, but incredibly hard to use, and nobody had any interest in it, so I abandoned it and lost the source code eventually. But it worked so well. I had invented this thing called magic tables to go along with it and make it easier to use, I forgot what they did, I just remember the name and how cool it was.

RustyRussell - 3 days ago

Andrew Tridgell's KnightCap did this differently: it's a network chess server, and it would dump its data to a file and re-exec. The trick here is that it would keep the (network) fds open for zero downtime. IIRC he used a Perl script called datadumper to gen the code marshal/demarshal the structures.

This has the advantage that reboots can be handled fairly seemlessly too (though there will be reconnections then of).

zoom6628 - 3 days ago

Maybe TinyC from Ballard et al could also be used given its ability to be a C interpreter?

uticus - 3 days ago

> When the library loads without error, look up the GAME_API struct.... If looking up the GAME_API fails, close the handle and consider it a failure.

Error handling strategies, and what fallback state things fall into when the hot code breaks, would be great to hear about.

mrheosuper - 2 days ago

iirc HolyC is an interpret language.