So I've been using SDL2 for quite some time now and quite enjoy it. However I've stumbled upon some beginner C++ questions on various places and one thing is mentioned a lot. "C++ standard library cannot handle graphics and windowing, use a 3rd party library (like SDL) for this". So that being said if C++ cannot handle and create windows and graphics on it's own then how can these 3rd party libraries that are written in C++ make it possible to create windows and graphics?
In other word what I'm reading is that C++ cannot create graphics/windows but if you use a library like SFML or SDL that is written in C/C++ then you can then use C++ to create graphics/window.
P.S. Yes I know SDL is written in C so I"ll use SFML for an example.
C++ has no native support for it. You have to leverage the system's APIs to do that (like WinAPI, for example). SFML/SDL/etc may be written in C/C++, but they use the operating system's APIs to create the windows. Different versions have to be written for each system they want to support.
SFML does this, and uses the OS's native APIs to handle window creation and whatnot for you. Then those libraries can use whatever graphics API they want (as long as the system supports it). SDL and SFML both leverage OpenGL for that.
You can check out the source code for SFML on their github and look at the native API code they use for the systems they support if you're curious about how they do it. You can do the same for SDL.
But the Windows API is written in C++ as well right? So at what point do these libraries use something beyond C++ to acess the hardware for stuff like this?
The API is far more C-like than C++-like, but that's just the interface that Windows provides to communicate with the operating system. You use the API to communicate with the OS, which internally can create windows, and underneath the hood Windows is handling the heavy work.
The libraries like SFML/SDL don't have to directly access hardware for that.
The operating system can write the API in whatever language they want, but they're just making the interface to communicate with the OS so you can create windows and whatnot.
It's kind of like:
You/me --> SFML/C++ --> OS-API --> OS --> Hardware
I think of them more of like wrappers, they just happen to be written in C++.