From 369fe1eba31f3e7a6f5424002eae88bfcb280efa Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 6 Jun 2018 23:35:13 +0300 Subject: Add support for build2 build --- odb/oracle/details/export.hxx | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'odb/oracle/details/export.hxx') diff --git a/odb/oracle/details/export.hxx b/odb/oracle/details/export.hxx index bce6195..ff819dc 100644 --- a/odb/oracle/details/export.hxx +++ b/odb/oracle/details/export.hxx @@ -9,6 +9,43 @@ #include +// Normally we don't export class templates (but do complete specializations), +// inline functions, and classes with only inline member functions. Exporting +// classes that inherit from non-exported/imported bases (e.g., std::string) +// will end up badly. The only known workarounds are to not inherit or to not +// export. Also, MinGW GCC doesn't like seeing non-exported function being +// used before their inline definition. The workaround is to reorder code. In +// the end it's all trial and error. + +#ifdef LIBODB_ORACLE_BUILD2 + +#if defined(LIBODB_ORACLE_STATIC) // Using static. +# define LIBODB_ORACLE_EXPORT +#elif defined(LIBODB_ORACLE_STATIC_BUILD) // Building static. +# define LIBODB_ORACLE_EXPORT +#elif defined(LIBODB_ORACLE_SHARED) // Using shared. +# ifdef _WIN32 +# define LIBODB_ORACLE_EXPORT __declspec(dllimport) +# else +# define LIBODB_ORACLE_EXPORT +# endif +#elif defined(LIBODB_ORACLE_SHARED_BUILD) // Building shared. +# ifdef _WIN32 +# define LIBODB_ORACLE_EXPORT __declspec(dllexport) +# else +# define LIBODB_ORACLE_EXPORT +# endif +#else +// If none of the above macros are defined, then we assume we are being used +// by some third-party build system that cannot/doesn't signal the library +// type. Note that this fallback works for both static and shared but in case +// of shared will be sub-optimal compared to having dllimport. +// +# define LIBODB_ORACLE_EXPORT // Using static or shared. +#endif + +#else // LIBODB_ORACLE_BUILD2 + #ifdef LIBODB_ORACLE_STATIC_LIB # define LIBODB_ORACLE_EXPORT #else @@ -35,6 +72,8 @@ # endif #endif +#endif // LIBODB_ORACLE_BUILD2 + #include #endif // ODB_ORACLE_DETAILS_EXPORT_HXX -- cgit v1.1