views:

52

answers:

1

When a whole project (solution) consists of multiple subprojects (.vcproj), what is a preferable way to tie them: as static libraries or as shared libraries?

Assuming that those subprojects are not used elsewhere, the shared libraries approach shouldn't decrease memory usage or load time.

+3  A: 

Opinion: Static, in nearly all cases.

Building interfaces across dynamically loaded libraries is much harder in C++ on Windows. For example, unlike with Unix shared objects, you cannot have a standard singleton for all modules, because a DLL would have it's own set of static variables.

Object oriented interfaces are often hard to export from a DLL.

As for load time, issues like rebasing need to be adressed with shared libraries.

On the other hand, the libraries you do not share today might become shared in future. However, in most cases it is better to pay the price of duplication in RAM or disk image than the price of dependency on extra modules.

Pavel Radzivilovsky