[asterisk-dev] policy for managing headers

Simon Perreault simon.perreault at viagenie.ca
Fri Nov 16 09:38:56 CST 2007


On Friday 16 November 2007 05:58:25 Luigi Rizzo wrote:
> My proposal would be to let asterisk/compat.h deal with at least
> the most common headers, or those that might have platform-specific
> names or locations (most noticeably socket.h and the various
> network-related ones).

Here's another idea:

asterisk/compat/socket.h
asterisk/compat/stdint.h
asterisk/compat/sys/types.h
...

Each file includes the right platform-specific header and performs any other 
necessary magic related to this header file.

Then you add asterisk/compat at the beginning of the include path and use the 
headers normally and the compatibility magic just happens.

Advantages:
- You don't even need to know compat is there. It just works.
- You don't needlessly aggregate headers, which would increase compile time.
- Existing source code doesn't need to be modified to benefit from it.

Disadvantages:
- Code needs to use Linux header locations. (Could be argued that this is not 
really a disadvantage, but let's be fair.)



More information about the asterisk-dev mailing list