How To Make Special Purpose Libraries

There are many libraries in C++, but how are they made?

For example: SDL, SFML, Open CV, STK

There are no special functions in C++ from which we can create such libraries,
If I wanted to create a library that processes sound signals, how would I do that?
How can I access the mic, speakers and process the signals.

Open CV processes videos but which functions does it use?

Thanks
A library is just a collection of source and header files. If you take your program and remove the main function, it could technically be considered a library of its own.

Libraries often use other libraries internally, and many times have to detect your operating system to interact with your OS directly. This is messy and it's why its done in libraries and not your "real" program. A library is effectively an abstraction layer over one or more less-desired libraries.
Last edited on
Building a library is really a function of the linker, not C++.
The linker combines various object files into a library.
Those object files can be built from any language.

When a third party creates a library, they can do so in one of two ways.
1) An open source library. All source and headers files are released and you can build the library yourself.
2) A closed source library. Only the header files and the library file are released.

To know how to use a library, you have to familiarize yourself with the library API.

The problem with library files (*.lib, *.a, *.dll, *.so) is that they are inherently not portable. In some cases they may even be locked to an exact version of Windows/*nix. That's why precompiled library binaries often have multiple versions for different operating system environments.
Topic archived. No new replies allowed.