Next: , Up: Writing modules   [Contents][Index]

4.1 Source code files

Every API (C functions or variables) provided should be declared in a header file (.h file) and implemented in one or more implementation files (.c files). The separation has the effect that users of your module need to read only the contents of the .h file and the module description in order to understand what the module is about and how to use it—not the entire implementation. Furthermore, users of your module don’t need to repeat the declarations of the functions in their code, and are likely to receive notification through compiler errors if you make incompatible changes to the API (like, adding a parameter or changing the return type of a function).