Selectively use dynamic linking?
How can I create a program that is partially dynamically linked, and some parts set to statically linked (like some third party libraries)?
Thanks
Jack
Re: The linker cannot find the file I didn't specify in my project?
You download the static libs for the 3p project if you want to link statically, otherwise the dynamic libs :)
No proper libs available? If you have the source of the 3p project compile the lib yourself.
Re: The linker cannot find the file I didn't specify in my project?
Hello,
I tried to wrap a big project which consists of a numerous sub-projects into statically linked library.
But one of the sub-projects complains that
The link time library (statically linked) is not suitable for a dynamically linked library as a final product.
Thanks
Jack
Re: The linker cannot find the file I didn't specify in my project?
Then I think you will have to investigate why they claim static linking is not suitable. I've seen this type of statement before and there are valid reasons for it, but could also be nonsense or simply the license which disallows static linking.
Re: The linker cannot find the file I didn't specify in my project?
A third party code (including plain C runtime) may be released in a library of various forms, e.g. static .lib or dynamic .dll.
In case some of your code uses static library, and other does require to be linked with its DLL sibling, you cannot build all this into a single binary. You just can't. To solve that you may either get rid of inconsistency, i.e. use strictly the same type of third party library, .lib or .dll, all over your project, or you split your code to separate dlls, each one using only one type of third party library, and build your final app of the dlls.
A problem inevitably introduced with the last approach is that you cannot be sure about a memory (de)allocation uniformity in case of mixing different libraries. And because of this, you need to take a special care about freeing particular objects in the same binary where it was allocated.