How do programmers know what's inside my custom library?

After I created a graphic library for example and then if I want to distribute it to other people to use, how do they know how to use my library and what's inside it? How do they access my functions and classes if I don't give them the source code?

You give them the header files for your accessible classes and methods. Of course you also have to provide documentation so they know how to use it.
So if I give them the header file and documentation, why not just give them the source code?
You wouldn't give them the source code for the same reason that any library doesn't provide the actual source code. At best, it's not required - at worst, it gets tampered with.

Typically, your "library" contains header files (which do not contain any implementations) and most likely a static library file (.lib), with which they can link their project.
So if I give them the header file and documentation, why not just give them the source code?

Because in your source files there are those brilliant algorithms and solutions which make your code so more efficient than others’ one that it will make you the richest programmer on Earth, whereas in your headers there’s only the description of what your code does, not how.

(I’m in favour of giving source code too, anyway)
Last edited on
Thanks friends for your answers.
Topic archived. No new replies allowed.