Api Design For C Today

: Avoid global variables within your library. Instead, pass a "context" or "handle" pointer to every function that needs to maintain state, which also helps with thread safety. Recommended Resources for Deep Dives

: Since C has a flat namespace, use consistent prefixes for all public functions and types (e.g., libname_create_context() ) to avoid naming collisions with other libraries. API Design for C

: While Martin Reddy's API Design for C++ is a classic, its principles regarding stability, documentation, and testing are highly applicable to C as well. For C-specific patterns, " C Interfaces and Implementations " by David Hanson is a definitive guide. : Avoid global variables within your library