Pothos  0.4.1-gb758ed46
The Pothos dataflow programming software suite
Namespaces | Macros
Static.hpp File Reference
#include <Pothos/Config.hpp>
#include <Pothos/System/Version.hpp>

Go to the source code of this file.

Namespaces

 Pothos
 

Macros

#define POTHOS_STATIC_FIXTURE_DECL
 
#define pothos_static_block(name)
 

Detailed Description

Static initialization implementation for load-time registration.

Macro Definition Documentation

#define pothos_static_block (   name)
Value:
POTHOS_STATIC_FIXTURE_DECL void name ## StaticFixtureInit__(void); \
template <Pothos::Detail::InitFcn init> \
struct name ## StaticFixture__ \
{ \
name ## StaticFixture__(void) \
{ \
Pothos::Detail::safeInit(POTHOS_ABI_VERSION, #name, init); \
} \
}; \
static name ## StaticFixture__<&name ## StaticFixtureInit__> name ## StaticFixtureInstance__; \
POTHOS_STATIC_FIXTURE_DECL void name ## StaticFixtureInit__(void)
#define POTHOS_STATIC_FIXTURE_DECL
Definition: Static.hpp:35
#define POTHOS_ABI_VERSION
Definition: Version.hpp:38
POTHOS_API void init(void)

pothos_static_block - macro that declares code to be run at init time Example usage: pothos_static_block(someValidFunctionName) { //your code here to be run at init time }

#define POTHOS_STATIC_FIXTURE_DECL

Define the tokens used to declare a static block's function. The address of the function is used to make the static fixture class unique across the complete library + module address space.

Clang can only use static, inline functions of the same name will overlap. MSVC can only use inline because static cannot be used as a template argument. And GCC can handle all possibilities: static, inline, and static inline.

The specific reason for this implementation and its caveats is because clang will cause symbol overlap for class and functions with the same name across modules, even if they are not exported.