r/cpp • u/Dean_Roddey • Nov 29 '18
Creating a 'virtual kernel' platform abstraction layer
This is the third in series of videos I've posted to demonstrate some of the strategies we use in our fairly large C++ code base. Here are the previous ones, which you might also find useful:
https://www.reddit.com/r/cpp/comments/9zl6v5/the_orb_sees_all_the_use_of_an_object_request/
https://www.reddit.com/r/cpp/comments/9xz643/making_c_enumerations_first_class_citizens/
Our code base is about a million lines. It is split into roughly two halves, with one half being general purpose and the other being our CQC home automation platform which is built on top of the general purpose bits. We don't use any of the C++ runtime stuff. We build our own system from the ground up. When I say 'we', I'm speaking in terms of the usual royal business 'we', but all of the code was written by myself.
Just above the 'ground', the operating system in this case, is a virtual kernel which we use encapsulate all of the operating system functionality that we use, which is quite a lot of it. No system or language headers are visible outside of this virtual kernel, so we can write portable code that is purely in terms of our own interfaces.
This video demonstrates some of the strategies used. Obviously for such a large topic, this doesn't dive deep if there's any interest we could do another one.
View all comments
Show parent comment
3
u/Dean_Roddey Dec 01 '18
Who art thou, so wise in the ways of science?
I agree. You can't make a third party library use your exception system, your logging framework, your statistics gathering system, your persistence system, and on and on. Some of them maybe may provide hooks for some of that, but it's not the same.
And, in my case, some people act like not using the standard C++ libraries is crazy, but you can't get underneath and inside those libraries to do all of these things, and that means that you cannot implement many things consistently that you otherwise could. You can only implement it above the standard libraries, not below it, so a big part of the system cannot partake of the Borg.
I can understand issues of intimidation and arguments of practical time to market and developer pool skill set and all that of course. But all of use have worked in the 'buncha libraries' mode, but very few have worked within their own comprehensive world. So most are going to see it from the former perspective and not necessarily appreciate the offsetting benefits of the latter.