Reputation:
So, can i use header only libraries, dynamic libraries and static libraries in a static library that I am making, without making all of those a one large static library?
To be specific, im writing a rendering engine in OpenGl, and im using quite a few tools. Namely,: GLFW, GLM, GLEW, and of course OpenGL.
Provided that the user has all of those, and/or I supply them with my library, can it be done?
Upvotes: 2
Views: 742
Reputation: 998
The question is more a matter of linkage resolution. Template libraries (header only) only have the code generated for the template types that have an explicit type instantiation; that will have to be in your library, or you will have to require a header-library dependency. Linkage resolution for both external and static libraries is resolved the same way--by using external references to the items in the static libraries or the libraries that reconcile the code in the dll's as external.
The complexity comes in the form of compatibility--debug vs release, 32bit vs 64 bit, OS architecture, compilation options, name mangling, and so forth.
The very simplest thing to do, and therefore likely the best, is to link your compilation modules into your static library, provide the header, and document the dependencies, and if you can provide the correct dependencies, so much the better.
If you're using VC, the Lib tool will help you get an understanding of the contents of the libraries. Learn to love it :)
Upvotes: 4