The `main` addon has no public API, but contains functionality to enable programs using Allegro to build and run without platform-specific changes.

On platforms that require this functionality (e.g. OSX) this addon contains a C `main` function that invokes al_run_main with the user’s own `main` function, where the user’s `main` function has had its name mangled to something else. The file that defines the user `main` function must include the header file `allegro5/allegro.h`; that header performs the name mangling using some macros.

If the user `main` function is defined in C++, then it must have the following signature for this addon to work:

    int main(int argc, char **argv)

This addon does nothing on platforms that don’t require its functionality, but you should keep it in mind in case you need to port to platforms that do require it.

Link with allegro_main.

Allegro version 5.2.11 - Last updated: 2026-02-09 02:00:43 UTC