cereal
A C++11 library for serialization
Classes | Macros
static_object.hpp File Reference

Internal polymorphism static object support. More...

#include "cereal/macros.hpp"

Go to the source code of this file.

Classes

class  cereal::detail::StaticObject< T >
 A static, pre-execution object. More...
 
class  cereal::detail::StaticObject< T >::LockGuard
 A class that acts like std::lock_guard. More...
 

Macros

#define CEREAL_DLL_EXPORT   __attribute__ ((visibility("default")))
 Prevent link optimization from removing non-referenced static objects. More...
 
#define CEREAL_USED   __attribute__ ((__used__))
 

Detailed Description

Internal polymorphism static object support.

Macro Definition Documentation

◆ CEREAL_DLL_EXPORT

#define CEREAL_DLL_EXPORT   __attribute__ ((visibility("default")))

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)