[Insight-users] Shared libraries

Brad King brad.king at kitware.com
Fri, 02 Apr 2004 16:48:12 -0500


Zachary Pincus wrote:
> Hello,
> 
> I'm hoping that by using the shared libraries build for ITK, I can cut 
> down on compile times and executable size for my projects because every 
> single project I compile won't have to instantiate from template common 
> combinations of image and pixel types, etc.
> 
> Is this in fact the case -- do the shared libraries contain 
> instantiations of commonly-templated class combinations? If so, how does 
> one instruct the compiler to look in  a library before instantiating 
> from a template (or does cmake take care of that)?
> 
> Or am I totally misapprehending what the shared libraries are for? If 
> I'm mistaken, I would be most interested in someone enlightening me 
> about the purpose of the shared library option.

The ITK shared libraries currently contain only non-template classes. 
Compiling your application will still cause all the needed 
instantiations to be created.  We are planning to solve this problem 
using the non-standard "extern template instantiation" extension 
provided by many compilers.  Then common instantiations would be 
provided by the shared library and not compiled into every executable. 
However, this work has not yet been finished.

-Brad