When porting AGS to Linux, I noticed they copied src/file.c from allegro in order to rename pack_fopen to old_pack_fopen and override it with a new pack_fopen that handles looking inside another file (and then falls back to calling old_pack_fopen).
Since this is a relatively dirty hack and doesn't work with static linking at all (and I can see valid reasons to do it), I'd propose to rename pack_fopen to allegro_pack_fopen and adding a pack_fopen that just calls allegro_pack_fopen, but is declared a weak symbol.
- "Normal" applications using allegro will keep working just fine
- AGS and others wanting to do the same thing can override pack_fopen without having to duplicate code
- Overridden pack_fopen functions can call the original (because it's available unconditionally through the __allegro_pack_fopen symbol)
Log in to post a comment.