How are libraries typically distributed? Because they have to be compiled with the same compiler under the same settings as the project using it, distributing the .dll
, .lib
, etc. seems impractical. Is the source code just made available for download?
-
What language is this? – Marcie Dec 17 '10 at 15:19
-
1@Marcie C++. [These are extra words so I can post a comment.] – Maxpm Dec 17 '10 at 15:22
As you noticed, distributing libraries is impractical... You have to care about the version of the compiler (including Service Packs), the settings used to compile, etc. We used to have 6 different ports for each version of Visual Studio: the most important difference was the Runtime Library used (/ST, /MT or /MD).
But unless you can distribute the source code, you'll have to live with this...
You can distribute the .dll, there's nothing wrong with that. In .NET, when you reference a library it doesn't need to be recompiled, you can just use it as is. Plenty of projects distribute their binaries but not their source.
-
Not according to some of the answers on stackoverflow.com/questions/4446620/…. – Maxpm Dec 17 '10 at 15:20
-
@Maxpm: Ah, yeah, C++ may be different. You will need different version for different platforms, as Justin said in his answer + follow recommendations you got in that SO question. In general, though, there's no requirement to distribute source with libraries. – Adam Lear♦ Dec 17 '10 at 15:43
If you are going to distribute Libraries or Applications written in C++, you will need to provide a different binary for each platform you are going to support. For example, Windows, Linux, Mac, etc. You may also need to provide different versions for each architecture, for example 32-bit Windows vs 64-bit.