static\_object.hpp(3) Library Functions Manual static\_object.hpp(3)

# [NAME](#NAME)

static\_object.hpp - Internal polymorphism static object support.

# [SYNOPSIS](#SYNOPSIS)

#include 'cereal/macros.hpp'

## [Classes](#Classes)

class **cereal::detail::StaticObject&lt; T &gt;**  
A static, pre-execution object. class **cereal::detail::StaticObject&lt; T &gt;::LockGuard**  
A class that acts like std::lock\_guard.

## [Macros](#Macros)

#define **CEREAL\_DLL\_EXPORT** \_\_attribute\__ ((visibility('default')))  
Prevent link optimization from removing non-referenced static objects. #define **CEREAL\_USED** \_\_attribute\__ ((\_\_used\_\_))

## [Variables](#Variables)

template&lt;class T&gt; T & **cereal::detail::StaticObject&lt; T &gt;::instance** = **StaticObject**&lt;T&gt;::create()

# [Detailed Description](#Detailed_Description)

Internal polymorphism static object support.

# [Macro Definition Documentation](#Macro_Definition_Documentation)

## [#define CEREAL\_DLL\_EXPORT \_\_attribute\__ ((visibility('default')))](#_define_CEREAL_DLL_EXPORT_____attribute___%28%28visibility%28'default'%29%29%29)

Prevent link optimization from removing non-referenced static objects. Especially for polymorphic support, we create static objects which may not ever be explicitly referenced. Most linkers will detect this and remove the code causing various unpleasant runtime errors. These macros, adopted from Boost (see force\_include.hpp) prevent this (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE\_1\_0.txt or copy at http://www.boost.org/LICENSE\_1\_0.txt)

# [Author](#Author)

Generated automatically by Doxygen for cereal from the source code.

Mon Oct 26 2026 02:55:37 cereal

---

Document: static_object.hpp(3) from cereal 1.3.2-r7 (Chainguard OS)
Source: https://github.com/USCiLab/cereal
