Thanks for the information!

I clearly need to brush up on when different types of globals and static 
variables get initialized.

Brad

On Apr 12, 2012, at 10:22 AM, Brad King wrote:

> On 4/12/2012 9:56 AM, Bradley Lowekamp wrote:
>> the ImageIO Factories are registered by static initialization
>> in each translation unit which includes tikImageFileReader.h.
> 
> That's correct, but only for translation units in applications.
> 
> This is the only solution I've found that preserves the pre-
> modularization registration behavior without requiring every
> application to *explicitly* call an init function.  The app
> must do the init because after modularization the base classes
> cannot magically know about all their implementations in other
> modules.  The solution is to inject static initalization into
> translation units of applications.
> 
>> C++ does not specify the thread safety of static initialization.
> 
> By the time main() runs to start threads other than the main one
> the static initialization will have completed.  The concern should
> only exist for dynamically loaded libraries (plugins).  For those
> an application developer can compile with the option that says
> not to do the auto init magic.  Just add
> 
>  set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1)
> 
> before including ITK in the application CMake code.
> 
> -Brad K

========================================================
Bradley Lowekamp  
Medical Science and Computing for
Office of High Performance Computing and Communications
National Library of Medicine 
[email protected]



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-developers

Reply via email to