allegro_exit(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– allegro_exit β€” bestie, it's time to log off πŸ’–

okay so you're deep in the allegro_exit(3) page from the Allegro manual, and honestly? this one is a little goodbye note. it shuts the whole Allegro system down. cute, short, but there's a trap in here so stay with me 🫢


✨ NAME ✨

allegro_exit β€” closes down the Allegro system, like closing the group chat at 3am πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro.h>

void allegro_exit();

πŸ¦‹ DESCRIPTION πŸ¦‹

So what does it actually do? It closes down the Allegro system. That means:

  • it puts the system back into text mode πŸ“
  • it removes whatever mouse, keyboard, and timer routines have been installed πŸ–±οΈβŒ¨οΈβ°

And here's the tea, bestie: you don't normally need to bother making an explicit call to this function, because allegro_init() installs it as an atexit() routine, so it just... gets called automatically when your program exits. the function literally handles itself. main character energy, no cap πŸ‘‘

⚠️ BUT. After you call this function, other functions like destroy_bitmap() will most likely crash. πŸ’€ like, for real.

This is a whole problem for C++ global destructors, which usually get called after atexit(). So don't put Allegro calls in them. periodt.

The fix? Write that destructor code in another method which you can manually call before your program exits, and boom β€” problem avoided. you're so smart for that 🧚


πŸ’œ SEE ALSO πŸ’œ


okay that's the whole page, and yes it really is this short β€” iconic of it honestly 🌈

and for the lil sign-off: this whole thing comes from the Allegro manual, version 4.4.3 πŸŽ€ mwah, go forth and exit cleanly, bestie πŸ’–βœ¨

πŸ“¦ where this page comes from