[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] libjpeg
Miro Kropacek a écrit :
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.
The only solution is namespaces.
When the language does not support them, they can be emulated by using
prefixes in identifier names, for example:
In fancy_lib.h:
typedef short FANCY_LIB_INT16;
If the library didn't use prefixes, there will always be problems.
By the way, I repeat that once once again:
When there is an unexplainable compilation problem, look at the
preprocessor output: look at the gcc command in the makefile output,
replace -c by -E and change the name of the output file.
You will see instantly the nature of the problem.
--
Vincent Rivière