END_OF_MAIN(3)
π END_OF_MAIN π
ok so this is a page from the Allegro manual β the Allegro game programming library manual, section 3 β and it's all about one tiny lil macro called END_OF_MAIN. she's small but she's doing the MOST. π
β¨ NAME β¨
END_OF_MAIN β the macro you put right after your main() function, bestie. literally that's her whole job. Allegro game programming library core. π
πΈ SYNOPSIS πΈ
#include <allegro.h>
Macro END_OF_MAIN()
that's it. that's the whole thing. no args, no nothing. she just exists at the end of your file. π
π¦ DESCRIPTION π¦
ok so here's the tea, and it's actually important so listen up π«Ά
to keep everything cross-platform compatible, you have to put this macro at the very end of your main function. like, the actual end. not in the middle, not before your closing brace situation β the end end.
the way this works is she uses some 'magic' β¨ to mangle your main procedure on the platforms that need it, like:
- Windows
- some flavours of UNIX
- MacOS X
basically the platforms that are picky about this stuff. π
and here's the slay part: on the other platforms β the chill ones β this macro compiles to nothing. literally nothing. zero. so you do not have to #ifdef around it, and honestly thank god, because nobody wants to be writing preprocessor guards around a single macro at 3am. π
π Example π
int main(void)
{
allegro_init();
/* more stuff goes here */
...
return 0;
}
END_OF_MAIN()
see how she's sitting outside the closing brace? yeah. that's the vibe. main character energy fr fr. π₯
β οΈ ngl bestie if you forget her, the platforms that need the mangling are gonna be so dramatic about it. just always dropEND_OF_MAIN()after yourmainand you're golden. π
π SEE ALSO π
- Allegro β the whole library, the moment, the icon π
and that's the page!! short, sweet, absolutely iconic, no notes. π
this was Allegro, version 4.4.3, serving END_OF_MAIN(3) realness, and that's the sign-off bestie β go put that macro at the end of your main and slay π
β¨π§
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms