Forwarding requested by Christoph

> Hi,
> 
> > Wouldn't it be better if an application could also get the library
> > version at runtime, rather than only at compile time. Otherwise, the
> > "run on any system without recompile" argument doesn't hold long.
> 
> Also runtime would be nicer, BUT, if you would like to use a symbol (or
> macro)
> >from the library, that is only in newer versions available, you will get
> compile errors :(
> 
> Also a possible way would, that you use macros to detect version in
> compiling
> time (compiling  with newer ggi libs would make possibility to use older
> and newer functions)
> 
> For example:
> 
> #ifdef GGI_VERSION > VERSIONCODE(2,0,1)
>     if (ggiVersion() > VERSIONCODE(2,0,1))
>     {
>  ...
>     }
> #endif
> 
> This will compile on newer libs, and will run on every lib that contains
> ggiVersion symbol.
> 
> 'VERSIONCODE' should be a macro:
> #define GGI_VERSION_MAJOR 2
> #define GGI_VERSION_MINOR 0
> #define GGI_VERSION_PATCH 1
> 
> #define GGI_VERSIONCODE() (GGI_VERSION_MAJOR << 16 | GGI_VERSION_MINOR <<
> 8 | GGI_VERSION_PATCH)
> 
> Feel free to change this.
> 
> Comments awaited!

IMO, this solution is great looks clean.

I suggest to introduce this solution in the libggi 2.0.2 bugfix release.
Then we assume, that people uses libggi 2.0.2 and the #ifdef...#endif block
is 
unneeded. People with older version are adviced to upgrade... ;P


-- 
CU,

Christoph Egger
E-Mail: [EMAIL PROTECTED]

GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


----- End forwarded message -----

Reply via email to