RejectedSoftware Forums

Sign up

library vs sourceLibrary

A DUB package of mine, which consists of a single source file ('fixed' for those who are curious), has a targetType of 'sourceLibrary'. A user of the package has suggested that it should be 'library' instead. Would someone be willing to explain what the full difference is between the two and why I should choose 'library' over 'sourceLibrary' (or visa-versa).

My current understanding is that library generates a binary library to be linked, while sourceLibrary doesn't, and that, for a single file, generating a link library is not justified.

Any help would be appreciated. Thank you.

Regards

Re: library vs sourceLibrary

Am 29.03.2016 um 04:39 schrieb Jason:

A DUB package of mine, which consists of a single source file ('fixed' for those who are curious), has a targetType of 'sourceLibrary'. A user of the package has suggested that it should be 'library' instead. Would someone be willing to explain what the full difference is between the two and why I should choose 'library' over 'sourceLibrary' (or visa-versa).

My current understanding is that library generates a binary library to be linked, while sourceLibrary doesn't, and that, for a single file, generating a link library is not justified.

Any help would be appreciated. Thank you.

Regards

The difference is just that the dependent package can decide for
"library" dependencies if they will be compiled as a static, dynamic or
source library. Choosing one of the other options makes that decision fixed.

The issue with "sourceLibrary" is that it may result in linker errors
due to duplicate symbols if the source library is used multiple times
within the same dependency tree. Libraries that don't specify any source
files (Deimos style bindings) don't have this issue, though.