[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] libjpeg



> Does this suggest that there should be an extra test added to
> jmorecfg.h for Mint that stops it trying to redefine INT16 ?
>
> Alternatively, should Mint define XMD_H somewhere ?
The big problem of typedef is one can't check if the type already
exists or not (in comparison to #define for example), correct me if
I'm wrong. So you have to make check for something else, __MINT__
isn't good idea (you can use libjpeg with non-conflicting source code,
i.e. not HW), defining XMD_H (what if someone port XMD library one
day?) neither. As I suggested earlier, find the *source* of that INT16
and make check for that. I.e. let's assume HW source code does this:

#include <fancy_lib.h>
#include <jpeg.h> /* includes jmorecfg.h */

int main( void )
{
  INT16 x = 10;
  return x * x;
}

If "fancy_lib" defines INT16, the safest solution is to check for
FANCY_LIB_H in the same way as for XMD_H, i.e. #if defined (XMD_H_) ||
defined (FANCY_LIB_H). Or to swap those two lines and make check for
libjpeg in fancy_lib :)

Generally, is there any clean solution this typedef dependency hell?
I've encountered it once or twice and never found clean solution what
to do if two totally separate libraries define the same derived
type... C++ solves this with namespaces but in C it's quite annoying.

Hope this helps.

-- 
MiKRO / Mystic Bytes
http://mikro.atari.org