[AD] [ alleg-Feature Requests-3302567 ] [4.x]Make pack_fopen a weak symbol, add __allegro_pack_fopen |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: noreply@xxxxxxxxxx
- Subject: [AD] [ alleg-Feature Requests-3302567 ] [4.x]Make pack_fopen a weak symbol, add __allegro_pack_fopen
- From: "SourceForge.net" <noreply@xxxxxxxxxx>
- Date: Mon, 16 May 2011 10:50:37 +0200
Feature Requests item #3302567, was opened at 2011-05-15 22:19
Message generated for change (Comment added) made by bero
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355665&aid=3302567&group_id=5665
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: Bernhard Rosenkraenzer (bero)
Assigned to: Nobody/Anonymous (nobody)
Summary: [4.x]Make pack_fopen a weak symbol, add __allegro_pack_fopen
Initial Comment:
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.
This way:
- "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)
----------------------------------------------------------------------
>Comment By: Bernhard Rosenkraenzer (bero)
Date: 2011-05-16 10:50
Message:
Wrapping pack_fopen through #define doesn't do the trick because the
override is needed for the uses of pack_open inside allegro as well (e.g.
load_voc() in allegro/src/sound.c uses pack_fopen to load the sound files,
and we can't #define that usage away, when in fact we need it to load the
sound file from a container only the overloaded pack_fopen can handle).
Also affects loading FLIs (allegro/src/fli.c), pictures
(allegro/src/bmp.c, allegro/src/tga.c, allegro/src/pcx.c) and probably
more.
----------------------------------------------------------------------
Comment By: Thomas Fjellstrom (strangemoose)
Date: 2011-05-15 22:51
Message:
I don't see why AGS can't just make a wrapper for pack_fopen. Either
directly or through a #define pack_fopen. That is, have a my_pack_fopen
which gets called instead of pack_fopen, which then does what it wants,
then tries pack_fopen.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355665&aid=3302567&group_id=5665