Handmade Network»Forums
3 posts
How to manage common codebase between different projects?

I started pulling the common code I use in my different projects, and it's slowly becoming my own codebase, as I see is usual to do here. The problem is, I don't know how to manage it. At first I copied and pasted the code and changed it only on the project I was working on, then copied the new version to a newer project and so on, but for example some times I needed to fix bugs in the codebase for many projects, so I needed to duplicate the work for all of the affected ones. Now I use a monorepo as an umbrella, where all my projects live and share the same codebase. I generally include one header cb.h, compile the full cb.c and that's it. But then, when I change some API, I need to change it for all affected projects, otherwise they do not compile anymore.

What is your way of managing your codebase?

Simon Anciaux
1356 posts
How to manage common codebase between different projects?

But then, when I change some API, I need to change it for all affected projects, otherwise they do not compile anymore.

I'm doing just that, updating the different projects to use the new API, and only when I actually need to do a modification to a project (I'm not updating every project every time I modify the API).

I never found that to be an issue, but I suppose it might depend on what your projects are and how often you need to modify them. If I really need to recompile a project with old APIs, I use SVN to get the version of the API that the project was build against.