I have a C++ solution which contains an executable project and a static library. The static library is a reference of the executable project.
The static library needs an external dependency. I would like to create a wrapper for the external dependency in a separate solution so that I do not have to bring the dependency into my executable.
It's okay for my static library to know about my wrapper, but not the external dependency. I want to use my wrapper to provide an interface for my static library to the external dependency, without requiring it to know about anything besides the wrapper.
I made the wrapper as both a DLL and a static library, but I couldn't link it into my static library as there is no linkage option in Visual Studio. Also, the DLL wrapper did not create a companion .lib.
My question: What kind of linkage should I use on my wrapper to provide an interface for my static library to use an external dependency, without knowing about the external dependency, only the wrapper? And how do I wrap all the dependency functionality in my wrapper, so that my static library does not need any other dlls or libs besides my wrapper?
The main issue I encountered was adding a reference to the wrapper from my static library. It seems I can only do this if they are in the same solution. However, if they are in the same solution, then the solution (and my executable) gets polluted by the external dependency. I would much rather include only a single file (dll/lib) which cherry picks from the external dependency the functionality I will need, instead of including the entire external dependency unnecessarily.
I know how to create dlls and libs (https://msdn.microsoft.com/en-us/library/ms235636.aspx and https://msdn.microsoft.com/en-us/library/ms235627.aspx) and also ways to load them (https://msdn.microsoft.com/en-us/library/windows/desktop/ms684175%28v=vs.85%29.aspx and https://msdn.microsoft.com/en-us/library/7f0aews7.aspx). My question is more focused on how to wrap things in a dll (or lib) while only giving out a single dll (or lib), instead of every dll and/or lib that my dll/lib needs to run, and, in my case, how to link that dll/lib into a static library.
I'm on a Windows environment compiling with gcc.