#include "sp.h" std::shared_ptr g_foo; void function_that_takes_foo(std::shared_ptr foo) { g_foo = foo; } std::shared_ptr function_that_returns_foo() { return g_foo; }