
Interactive Programming in C (2014)
ofalkaed
created: July 23, 2025, 5:16 p.m. | updated: July 24, 2025, 1:56 a.m.
Until last week I didn’t know how to apply interactive programming to C. How does one go about redefining functions in a running C program?
void game_load ( struct game * game )The purpose of the game_load() function is to load the game API into a game struct, but only if either it hasn’t been loaded yet or if it’s been updated.
if ( handle ) { game -> handle = handle ; game -> id = attr .
const struct game_api * api = dlsym ( game -> handle , "GAME_API" ); if ( api != NULL ) { game -> api = * api ; if ( game -> state == NULL ) game -> state = game -> api .
int main ( void ) { struct game game = { 0 }; for (;;) { game_load ( & game ); if ( game .
1 week, 4 days ago: Hacker News: Front Page