Creating a Library

Hello everybody, I'm planning to create my own data structure library. How is the best way to do so? Is is just creating .h files with it's respective implementations? Thanks!
Is it just creating .h files with it's respective implementations? Thanks!


Well, in general, generic components would be implemented in terms of class and function templates, and so would be provided as a header-only library, probably along with a compiled test suite, a license, documentation, and usage examples, and maybe packaging information for some popular build tools.

If your library needs to be compiled separately, you would publish the source code too.

You would generally distribute all this stuff along with some kind of build script that creates the final product from source code.
or, if you are just now getting started:
a library is just code where you do not have a main() function. You compile it differently so that instead of an executable program, it makes a 'library' (or, an object file, really in compiler terms). Then when you make an executable program that uses it, you link the library back in by adding the .h file (so the new program can understand the function definitions well enough to know what to do) and using other compiler settings to link the library file into it.

Dynamic libraries are similar, but have some additional syntax (at least in windows).


What os and compiler? Google is your friend but someone can tell you some simple compiler settings to do this for your setup if you need a hand getting started with the basics.
Topic archived. No new replies allowed.