From 2b1513dc20d8c6a1d27c17d03d8bba98953ebfbc Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 19 Jul 2022 14:08:13 -0400 Subject: Separate export macro definitions between modules --- include/ingen/Module.hpp | 8 +++++++- include/ingen/client/client.h | 31 +++++++++++++++++++++++++++++++ include/ingen/ingen.h | 21 +++++++-------------- 3 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 include/ingen/client/client.h (limited to 'include') diff --git a/include/ingen/Module.hpp b/include/ingen/Module.hpp index b540fe7d..149c25f9 100644 --- a/include/ingen/Module.hpp +++ b/include/ingen/Module.hpp @@ -55,8 +55,14 @@ public: extern "C" { +#ifdef _WIN32 +# define INGEN_MODULE_EXPORT __declspec(dllexport) +#else +# define INGEN_MODULE_EXPORT __attribute__((visibility("default"))) +#endif + /** Prototype for the ingen_module_load() entry point in an ingen module. */ -INGEN_API ingen::Module* ingen_module_load(); +INGEN_MODULE_EXPORT ingen::Module* ingen_module_load(); } diff --git a/include/ingen/client/client.h b/include/ingen/client/client.h new file mode 100644 index 00000000..6f7ac9b5 --- /dev/null +++ b/include/ingen/client/client.h @@ -0,0 +1,31 @@ +/* + This file is part of Ingen. + Copyright 2014-2022 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_CLIENT_CLIENT_H +#define INGEN_CLIENT_CLIENT_H + +#if defined(_WIN32) && !defined(INGEN_CLIENT_STATIC) && \ + defined(INGEN_CLIENT_INTERNAL) +# define INGEN_CLIENT_API __declspec(dllexport) +#elif defined(_WIN32) && !defined(INGEN_CLIENT_STATIC) +# define INGEN_CLIENT_API __declspec(dllimport) +#elif defined(__GNUC__) +# define INGEN_CLIENT_API __attribute__((visibility("default"))) +#else +# define INGEN_CLIENT_API +#endif + +#endif // INGEN_CLIENT_CLIENT_H diff --git a/include/ingen/ingen.h b/include/ingen/ingen.h index ccdb5596..9292de46 100644 --- a/include/ingen/ingen.h +++ b/include/ingen/ingen.h @@ -17,21 +17,14 @@ #ifndef INGEN_INGEN_H #define INGEN_INGEN_H -#ifdef INGEN_SHARED -# ifdef _WIN32 -# define INGEN_LIB_IMPORT __declspec(dllimport) -# define INGEN_LIB_EXPORT __declspec(dllexport) -# else -# define INGEN_LIB_IMPORT __attribute__((visibility("default"))) -# define INGEN_LIB_EXPORT __attribute__((visibility("default"))) -# endif -# ifdef INGEN_INTERNAL -# define INGEN_API INGEN_LIB_EXPORT -# else -# define INGEN_API INGEN_LIB_IMPORT -# endif +#if defined(_WIN32) && !defined(INGEN_STATIC) && defined(INGEN_INTERNAL) +# define INGEN_API __declspec(dllexport) +#elif defined(_WIN32) && !defined(INGEN_STATIC) +# define INGEN_API __declspec(dllimport) +#elif defined(__GNUC__) +# define INGEN_API __attribute__((visibility("default"))) #else -# define INGEN_API +# define INGEN_API #endif #define INGEN_NS "http://drobilla.net/ns/ingen#" -- cgit v1.2.1