Re: [AD] Indexed datafiles |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: Re: [AD] Indexed datafiles
- From: Chris <chris.kcat@xxxxxxxxxx>
- Date: Thu, 5 Jan 2006 14:49:41 -0800
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=HFY8CKLGdItc5C86LW8EuqqYfh1hWfyXLGSqf61OD25yslspoZ6xypsDEP4XGvDC12mORAWUlW6BDXVJ+MQSXQH73ujVQ9BtYK3/MvE93YiJ6lrM08gE2CtUBheH4cYvOEoZiq18wq36q1sMqjOTVyrVciakd4lg1nN++OgBTwo=
On Thursday 05 January 2006 06:57, Elias Pschernig wrote:
> - You compile with 4.2.1, then linking against 4.2.1, 4.2.2, ... are ok,
> but against 4.2.0 is not. (I.e. we do not provide forward binary
> compatibility anymore, so you can link against a newer DLL, but not
> against an older.)
With backwards binary compatiblity (eg. only adding functions, not taking away
or changing struct sizes), I think the system would throw an error about
missing/unresolved functions before the program itself is ever run, if the
program and DLL are incompatible (lazy checking). However, if you wanted to
enforce that older DLLs may not be used on programs compiled with newer
headers, something like this would be sufficient:
#define MAKE_VERSION(a, b, c) (((a)<<16)|((b)<<8)|(c))
AL_INLINE(int, install_allegro, (int system_id, int *errno_ptr, AL_METHOD(int,
atexit_ptr, (AL_METHOD(void, func, (void))))),
{
int dll_v = _get_allegro_version(); /* This comes from the DLL. */
#if ((ALLEGRO_SUB_VERSION&1) == 0)
int dll_wip = dll_v & 255;
int dll_ver = dll_v & ~255;
/* Check that the x.y versions match (eg. 4.2 = 4.2) and that the DLL WIP
* version is at least as new as the headers we were compiled with */
if ((dll_ver != MAKE_VERSION(ALLEGRO_VERSION, ALLEGRO_SUB_VERSION, 0)) ||
(dll_wip < ALLEGRO_WIP_VERSION)) {
#else
/* Enforce strict header x.y.z == lib x.y.z for WIP branches */
if ((dll_v != MAKE_VERSION(ALLEGRO_VERSION, ALLEGRO_SUB_VERSION,
ALLEGRO_WIP_VERSION)) {
#endif
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("The
detected dynamic Allegro library is not compatible with this program"));
return !0;
}
return _install_allegro(system_id, errno_ptr, atexit_ptr);
}
One problem with this (as well as the current implementation) is that it
doesn't call _install_allegro at all if the versions aren't compatible. As I
understand it, _install_allegro was made to initialize stuff needed for
allegro_message even if the call ultimately fails. This no longer happens if
the it fails because of a version mismatch.
One solution may be to call
_install_allegro(SYSTEM_NONE, NULL, NULL);
before returning !0, if that would still initialize allegro_message.