Skip to content
Snippets Groups Projects
Commit 2eba0153 authored by David Thompson's avatar David Thompson
Browse files

Move implementation of vtkStringToken out of VTK.

This is so that tokens can be in a shared library even
when VTK itself is a set of static libraries.
A shared library is required in order for strings to be
interned in an object held in a class-static variable.
If this class is in a static library, a different instance
of the class-static variable is created inside each
library that links to the library. Keeping the library
dynamic means a single instance is available to all
consumers.

Our new third-party token library provides a singleton
class to prevent crashes due to (1) uncontrolled order of
static data initialization in static libraries and (2)
duplication of global objects when multiple libraries
(e.g., B, C, D) link to a static library (e.g., A) with
global symbols. Each downstream library (B, C, D) will
refer to its own copy of A's globals on some platforms.

+ No files are installed that might conflict with a
  "system" token library.
+ Header files are all installed in `include/vtk-9.3/token`
  and the library is told to add `include/vtk-9.3` to the
  installed header search path (so that `#include <token/X>`
  will work the same on both build and installed versions).
+ The namespace used is vtktoken so it is possible to link
  both vtktoken and a system-provided token library into
  the same executable.
parent 76a333a1
No related branches found
No related tags found
Loading
Showing
with 317 additions and 473 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment