diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-06-06 23:35:13 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-06-18 14:28:42 +0300 |
commit | 369fe1eba31f3e7a6f5424002eae88bfcb280efa (patch) | |
tree | 8ed97a28d17953ef956199d7f6c7cb5c7c9459cf /odb/oracle/details/export.hxx | |
parent | e3c608545cedcd5202abb155bb94d17f7174451b (diff) |
Add support for build2 build
Diffstat (limited to 'odb/oracle/details/export.hxx')
-rw-r--r-- | odb/oracle/details/export.hxx | 39 |
1 files changed, 39 insertions, 0 deletions
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 <odb/oracle/details/config.hxx> +// 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 <odb/post.hxx> #endif // ODB_ORACLE_DETAILS_EXPORT_HXX |