Re: [AD] version check in allegro_init |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: Re: [AD] version check in allegro_init
- From: Chris <chris.kcat@xxxxxxxxxx>
- Date: Tue, 2 Nov 2004 00:39:25 -0800
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=KuTd0iQBF2GQyAzYKaOGR1V5WaJ6wY0XsFVrQInmU1UyY77L4ys+o9zD30DP8opa2VVsC7ow8Kje5bQ1W8hJw0b6VaTRqH5ntIco1JHW1/elJuAe2WU1TdMvbBJ/i+Vyva74oVJ9c1wZ9KTdzoVikFwh6eZpu9S6n0zVGnm+uMI=
On Tue, 2 Nov 2004 09:06:35 +0100, Hein Zelle <hein@xxxxxxxxxx> wrote:
> If you can think of a way to define a function in a header file only
> _once_, you could put an inline function in the headers that returns the
> version number. You can then call that function from allegro_init and
> compare with the compiled in version numbers. I'm not sure if it's
> technically possible to do this without getting multiple definitions
> of the function, though.
If you declare a function static inline, you can put it in a header.
Or, you could even make allegro_init a static inline funciton in a
header:
static inline int allegro_init()
{
if(ALLEGRO_VERSION != get_allegro_version())
{
sprintf(allegro_error, "Allegro version mismatch (%i in
header, %i in lib)", ALLEGRO_VERSION, get_allegro_version());
return !0;
}
return install_allegro(SYSTEM_AUTODETECT, &errno, atexit);
}
This, where get_allegro_version is built into the lib.
- Kitty Cat