Symbol visiblity

The commits defines a SPDLOG_API to mark classes that should
be exported when built as part of a shared library.
Only the registry_t class is marked with SPDLOG_API for now.

A new entry in tweakme.h has been added,
SPDLOG_ENABLE_DLL_IMPORT_EXPORT which default to undefined.
If defined, the import / export mechanism will be enabled and
if SPDLOG_EXPORTS is defined, the SPDLOG_API will export the
symbols, otherwise it will import them.

The default behavior is unchanged and SPDLOG_API will
expand to nothing.

See #693
pull/695/head
Arnaud 7 years ago committed by Kapp Arnaud
parent 217ad75ebd
commit a55083b379

@ -25,7 +25,7 @@
namespace spdlog { namespace spdlog {
namespace details { namespace details {
template<class Mutex> template<class Mutex>
class registry_t class SPDLOG_API registry_t
{ {
public: public:
registry_t<Mutex>(const registry_t<Mutex> &) = delete; registry_t<Mutex>(const registry_t<Mutex> &) = delete;

@ -141,3 +141,28 @@
// //
// #define SPDLOG_LEVEL_NAMES { "MY TRACE", "MY DEBUG", "MY INFO", "MY WARNING", "MY ERROR", "MY CRITICAL", "OFF" } // #define SPDLOG_LEVEL_NAMES { "MY TRACE", "MY DEBUG", "MY INFO", "MY WARNING", "MY ERROR", "MY CRITICAL", "OFF" }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to enable dll symbols export/import.
// You also need to define SPDLOG_EXPORTS when compiling shared library.
//
// #define SPDLOG_ENABLE_DLL_IMPORT_EXPORT
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// This defines the SPDLOG_API macro that allows a class marked with it to be
// exported by a dll.
// Users should define SPDLOG_EXPORTS=1 when compiling a shared library that
// uses spdlog.
#ifdef SPDLOG_ENABLE_DLL_IMPORT_EXPORT
#ifdef SPDLOG_EXPORTS
/*Enabled as "export" while compiling the dll project*/
#define SPDLOG_API __declspec(dllexport)
#else
/*Enabled as "import" in the Client side for using already created dll file*/
#define SPDLOG_API __declspec(dllimport)
#endif
#else
#define SPDLOG_API
#endif
///////////////////////////////////////////////////////////////////////////////

Loading…
Cancel
Save