using Qt's dllexport/import-macros

This commit is contained in:
jkriege2 2022-04-18 22:00:41 +02:00
parent d51d47b2f4
commit 725d19d616
4 changed files with 18 additions and 37 deletions

View File

@ -1,7 +1,6 @@
#ifndef jkqtcommon_IMPORT_H #ifndef jkqtcommon_IMPORT_H
#define jkqtcommon_IMPORT_H #define jkqtcommon_IMPORT_H
/* /*
Copyright (c) 2008-2020 Jan W. Krieger (<jan@jkrieger.de>) Copyright (c) 2008-2020 Jan W. Krieger (<jan@jkrieger.de>)
@ -39,7 +38,7 @@
JKQTCOMMON_LIB_EXPORT void exportedFunctionName(); JKQTCOMMON_LIB_EXPORT void exportedFunctionName();
\endcode \endcode
These macros append the appropriate \c __declspec(dllexport) and \c __declspec(dllimport) These macros append the appropriate \c Q_DECL_EXPORT and \c Q_DECL_IMPORT
to the function/class body and thus tell windows compilers to export these sysmbols from to the function/class body and thus tell windows compilers to export these sysmbols from
the shared library, or import them from a shared library. the shared library, or import them from a shared library.
@ -72,21 +71,15 @@
compiling an application), the symbols are imported compiling an application), the symbols are imported
*/ */
# ifndef __WINDOWS__ #include <QtCore/QtGlobal>
# if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)
# define __WINDOWS__
# endif
# endif
#ifdef __WINDOWS__
# ifdef JKQTCOMMON_LIB_IN_DLL # ifdef JKQTCOMMON_LIB_IN_DLL
# ifndef JKQTCOMMON_LIB_EXPORT # ifndef JKQTCOMMON_LIB_EXPORT
# ifdef JKQTCOMMON_LIB_EXPORT_LIBRARY # ifdef JKQTCOMMON_LIB_EXPORT_LIBRARY
/* We are building this library */ /* We are building this library */
# define JKQTCOMMON_LIB_EXPORT __declspec(dllexport) # define JKQTCOMMON_LIB_EXPORT Q_DECL_EXPORT
# else # else
/* We are using this library */ /* We are using this library */
# define JKQTCOMMON_LIB_EXPORT __declspec(dllimport) # define JKQTCOMMON_LIB_EXPORT Q_DECL_IMPORT
# endif # endif
# endif # endif
# else # else
@ -94,13 +87,6 @@
# define JKQTCOMMON_LIB_EXPORT # define JKQTCOMMON_LIB_EXPORT
# endif # endif
# endif # endif
#else
# define JKQTCOMMON_LIB_EXPORT
#endif

View File

@ -39,7 +39,7 @@
JKQTFASTPLOTTER_LIB_EXPORT void exportedFunctionName(); JKQTFASTPLOTTER_LIB_EXPORT void exportedFunctionName();
\endcode \endcode
These macros append the appropriate \c __declspec(dllexport) and \c __declspec(dllimport) These macros append the appropriate \c Q_DECL_EXPORT and \c Q_DECL_IMPORT
to the function/class body and thus tell windows compilers to export these sysmbols from to the function/class body and thus tell windows compilers to export these sysmbols from
the shared library, or import them from a shared library. the shared library, or import them from a shared library.
@ -72,6 +72,8 @@
compiling an application), the symbols are imported compiling an application), the symbols are imported
*/ */
#include <QtCore/QtGlobal>
# ifndef __WINDOWS__ # ifndef __WINDOWS__
# if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32) # if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)
# define __WINDOWS__ # define __WINDOWS__
@ -83,10 +85,10 @@
# ifndef JKQTFASTPLOTTER_LIB_EXPORT # ifndef JKQTFASTPLOTTER_LIB_EXPORT
# ifdef JKQTFASTPLOTTER_LIB_EXPORT_LIBRARY # ifdef JKQTFASTPLOTTER_LIB_EXPORT_LIBRARY
/* We are building this library */ /* We are building this library */
# define JKQTFASTPLOTTER_LIB_EXPORT __declspec(dllexport) # define JKQTFASTPLOTTER_LIB_EXPORT Q_DECL_EXPORT
# else # else
/* We are using this library */ /* We are using this library */
# define JKQTFASTPLOTTER_LIB_EXPORT __declspec(dllimport) # define JKQTFASTPLOTTER_LIB_EXPORT Q_DECL_IMPORT
# endif # endif
# endif # endif
# else # else

View File

@ -39,7 +39,7 @@
JKQTMATHTEXT_LIB_EXPORT void exportedFunctionName(); JKQTMATHTEXT_LIB_EXPORT void exportedFunctionName();
\endcode \endcode
These macros append the appropriate \c __declspec(dllexport) and \c __declspec(dllimport) These macros append the appropriate \c Q_DECL_EXPORT and \c Q_DECL_IMPORT
to the function/class body and thus tell windows compilers to export these sysmbols from to the function/class body and thus tell windows compilers to export these sysmbols from
the shared library, or import them from a shared library. the shared library, or import them from a shared library.
@ -72,6 +72,8 @@
compiling an application), the symbols are imported compiling an application), the symbols are imported
*/ */
#include <QtCore/QtGlobal>
# ifndef __WINDOWS__ # ifndef __WINDOWS__
# if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32) # if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)
# define __WINDOWS__ # define __WINDOWS__
@ -83,10 +85,10 @@
# ifndef JKQTMATHTEXT_LIB_EXPORT # ifndef JKQTMATHTEXT_LIB_EXPORT
# ifdef JKQTMATHTEXT_LIB_EXPORT_LIBRARY # ifdef JKQTMATHTEXT_LIB_EXPORT_LIBRARY
/* We are building this library */ /* We are building this library */
# define JKQTMATHTEXT_LIB_EXPORT __declspec(dllexport) # define JKQTMATHTEXT_LIB_EXPORT Q_DECL_EXPORT
# else # else
/* We are using this library */ /* We are using this library */
# define JKQTMATHTEXT_LIB_EXPORT __declspec(dllimport) # define JKQTMATHTEXT_LIB_EXPORT Q_DECL_IMPORT
# endif # endif
# endif # endif
# else # else

View File

@ -39,7 +39,7 @@
JKQTPLOTTER_LIB_EXPORT void exportedFunctionName(); JKQTPLOTTER_LIB_EXPORT void exportedFunctionName();
\endcode \endcode
These macros append the appropriate \c __declspec(dllexport) and \c __declspec(dllimport) These macros append the appropriate \c Q_DECL_EXPORT and \c Q_DECL_IMPORT
to the function/class body and thus tell windows compilers to export these sysmbols from to the function/class body and thus tell windows compilers to export these sysmbols from
the shared library, or import them from a shared library. the shared library, or import them from a shared library.
@ -72,21 +72,16 @@
compiling an application), the symbols are imported compiling an application), the symbols are imported
*/ */
# ifndef __WINDOWS__ #include <QtCore/QtGlobal>
# if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)
# define __WINDOWS__
# endif
# endif
#ifdef __WINDOWS__
# ifdef JKQTPLOTTER_LIB_IN_DLL # ifdef JKQTPLOTTER_LIB_IN_DLL
# ifndef JKQTPLOTTER_LIB_EXPORT # ifndef JKQTPLOTTER_LIB_EXPORT
# ifdef JKQTPLOTTER_LIB_EXPORT_LIBRARY # ifdef JKQTPLOTTER_LIB_EXPORT_LIBRARY
/* We are building this library */ /* We are building this library */
# define JKQTPLOTTER_LIB_EXPORT __declspec(dllexport) # define JKQTPLOTTER_LIB_EXPORT Q_DECL_EXPORT
# else # else
/* We are using this library */ /* We are using this library */
# define JKQTPLOTTER_LIB_EXPORT __declspec(dllimport) # define JKQTPLOTTER_LIB_EXPORT Q_DECL_IMPORT
# endif # endif
# endif # endif
# else # else
@ -94,10 +89,6 @@
# define JKQTPLOTTER_LIB_EXPORT # define JKQTPLOTTER_LIB_EXPORT
# endif # endif
# endif # endif
#else
# define JKQTPLOTTER_LIB_EXPORT
#endif