I have some familiarity with C++, and concepts like compiling and linking static and dynamic libraries, which is what I understand as collections of code that simplify doing certain things.
But then I get confused in certain cases, for example, why is OpenGL considered an API? Why is it necessary to use other libraries like GLAD, freeGLUT or GLFW to interface with OpenGL?
And then other languages have this thing called package managers, like pip, node, cargo, and vcpkg for c/c++, where you install these packages that get used like libraries? What’s the difference?
Finally the ones I understand the least of are frameworks. I keep hearing the concept of frameworks like Angular for js and a lot of stuff that’s too alien for me because I’m still unfamiliar with web development.
So for example, I’m using the raylib library for a small game project I have. I link the .lib or .dll file to my executable file so I know I’m unambiguously using a library. How come there’s also Cocos2dx which is a framework? What’s the distinction?
They’re overlapping concepts, and can be used interchangeably. Sometimes a library can be all of them at the same time. In simple terms:
Not all APIs are libraries. For example, all websites have some interface to interact with them. A website is not a library.
Not all libraries are packages. A library don’t need to be distributed through a package manager.
Framework is a bit blurry where the line is drawn. I think if the library is used in such way that your entire program revolves around it, then it’s a framework. If you’re just using it a handful of times, then it’s not a framework.
React and Angular are frameworks in this regard. If you use them, then your entire programming is revolving around them. Any decision made is in regard to these frameworks.
I would say OpenGL is API, library and framework. Maybe also package depending on how it’s distributed.