I need to create an API that will allow my customer\'s developers to use a proprietary C module that will be released as a library (think .lib
or .so
-
Other people mentioned documentation concerns, so I'll stay away from those :-P. Firstly, make sure you have sane include guards. personally I tend to like:
FILENAME_20081110_H_
, basically the filename in all caps, then the full date, this is help ensure that it is unique enough, even if there is another header in the tree which has the same name. (For example, you could imagine two config.h's included from 2 different lib directories having guards which use CONFIG_H_
or something like that and thus having a conflict. It doesn't matter what you choose, so long as it is likely to be unique.
Also, if there is any chance this header will be used in a c++ project, please wrap your headers in blocks like this:
#ifdef __cplusplus
extern "C" {
#endif
/* your stuff */
#ifdef __cplusplus
}
#endif
This will save some headaches with name mangling issues and make it so they don't have to wrap the header externally with these.