[Insight-users] Shared libraries

Zachary Pincus zpincus at stanford.edu
Wed, 28 Apr 2004 00:11:10 -0700


Hello,

I just updated to the latest ITK CVS, and it looks like there are a few 
changes in the template instantiation arena. Specifically, 
itkExplicitInstantiations looks like it has some common instantiations 
-- very cool.

A few questions:
(1) What platforms/compilers does this seem to work on?
(2) Is this available from static and shared libraries, or only the 
shared libs?
(3) How can I tell if my compiler is properly taking the instantiations 
from the library and not rebuilding them each time? (That is, how can I 
tell if it's working?)

And while I'm asking impertinent questions:
If I do build with shared libraries, do I need to "make install"  
before they're accessible? (I assume so...) And, how do I tell that I'm 
actually linking in the shared libs to my executables? (I assume that 
one just checks with nm or libtool or whatever the platform-appropriate 
dependency checker is...)

Thanks for any enlightenment you can provide,
Zach Pincus

Department of Biochemistry and Program in Biomedical Informatics
Stanford University School of Medicine

On Apr 2, 2004, at 1:48 PM, Brad King wrote:

> 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
>