aboutsummaryrefslogtreecommitdiff
path: root/odb/mssql/details
diff options
context:
space:
mode:
Diffstat (limited to 'odb/mssql/details')
-rw-r--r--odb/mssql/details/.gitignore1
-rw-r--r--odb/mssql/details/build2/config-stub.h6
-rw-r--r--odb/mssql/details/build2/config-vc-stub.h6
-rw-r--r--odb/mssql/details/build2/config-vc.h16
-rw-r--r--odb/mssql/details/build2/config.h18
-rw-r--r--odb/mssql/details/config-vc.h6
-rw-r--r--odb/mssql/details/config.hxx11
-rw-r--r--odb/mssql/details/export.hxx39
8 files changed, 99 insertions, 4 deletions
diff --git a/odb/mssql/details/.gitignore b/odb/mssql/details/.gitignore
new file mode 100644
index 0000000..c6e608b
--- /dev/null
+++ b/odb/mssql/details/.gitignore
@@ -0,0 +1 @@
+options.?xx
diff --git a/odb/mssql/details/build2/config-stub.h b/odb/mssql/details/build2/config-stub.h
new file mode 100644
index 0000000..c1421d9
--- /dev/null
+++ b/odb/mssql/details/build2/config-stub.h
@@ -0,0 +1,6 @@
+/* file : odb/mssql/details/build2/config-stub.h
+ * copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC
+ * license : ODB NCUEL; see accompanying LICENSE file
+ */
+
+#include <odb/mssql/details/config.h>
diff --git a/odb/mssql/details/build2/config-vc-stub.h b/odb/mssql/details/build2/config-vc-stub.h
new file mode 100644
index 0000000..c5e7fd2
--- /dev/null
+++ b/odb/mssql/details/build2/config-vc-stub.h
@@ -0,0 +1,6 @@
+/* file : odb/mssql/details/build2/config-vc-stub.h
+ * copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC
+ * license : ODB NCUEL; see accompanying LICENSE file
+ */
+
+#include <odb/mssql/details/config-vc.h>
diff --git a/odb/mssql/details/build2/config-vc.h b/odb/mssql/details/build2/config-vc.h
new file mode 100644
index 0000000..6bb48cd
--- /dev/null
+++ b/odb/mssql/details/build2/config-vc.h
@@ -0,0 +1,16 @@
+/* file : odb/mssql/details/build2/config-vc.h
+ * copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC
+ * license : ODB NCUEL; see accompanying LICENSE file
+ */
+
+/* Configuration file for Windows/VC++ for the build2 build. */
+
+#ifndef ODB_MSSQL_DETAILS_CONFIG_VC_H
+#define ODB_MSSQL_DETAILS_CONFIG_VC_H
+
+/* Define LIBODB_MSSQL_BUILD2 for the installed case. */
+#ifndef LIBODB_MSSQL_BUILD2
+# define LIBODB_MSSQL_BUILD2
+#endif
+
+#endif /* ODB_MSSQL_DETAILS_CONFIG_VC_H */
diff --git a/odb/mssql/details/build2/config.h b/odb/mssql/details/build2/config.h
new file mode 100644
index 0000000..631017e
--- /dev/null
+++ b/odb/mssql/details/build2/config.h
@@ -0,0 +1,18 @@
+/* file : odb/mssql/details/build2/config.h
+ * copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC
+ * license : ODB NCUEL; see accompanying LICENSE file
+ */
+
+/* Static configuration file for the build2 build. The installed case
+ (when LIBODB_MSSQL_BUILD2 is not necessarily defined) is the only
+ reason we have it. */
+
+#ifndef ODB_MSSQL_DETAILS_CONFIG_H
+#define ODB_MSSQL_DETAILS_CONFIG_H
+
+/* Define LIBODB_MSSQL_BUILD2 for the installed case. */
+#ifndef LIBODB_MSSQL_BUILD2
+# define LIBODB_MSSQL_BUILD2
+#endif
+
+#endif /* ODB_MSSQL_DETAILS_CONFIG_H */
diff --git a/odb/mssql/details/config-vc.h b/odb/mssql/details/config-vc.h
new file mode 100644
index 0000000..79d5820
--- /dev/null
+++ b/odb/mssql/details/config-vc.h
@@ -0,0 +1,6 @@
+/* file : odb/mssql/details/config-vc.h
+ * copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC
+ * license : ODB NCUEL; see accompanying LICENSE file
+ */
+
+/* Dummy configuration file for Windows/VC++. */
diff --git a/odb/mssql/details/config.hxx b/odb/mssql/details/config.hxx
index 65b9652..b3ab3db 100644
--- a/odb/mssql/details/config.hxx
+++ b/odb/mssql/details/config.hxx
@@ -7,11 +7,14 @@
// no pre
-#ifdef _MSC_VER
-#elif defined(ODB_COMPILER)
+#ifdef ODB_COMPILER
# error libodb-mssql header included in odb-compiled header
-#else
-# include <odb/mssql/details/config.h>
+#elif !defined(LIBODB_MSSQL_BUILD2)
+# ifdef _MSC_VER
+# include <odb/mssql/details/config-vc.h>
+# else
+# include <odb/mssql/details/config.h>
+# endif
#endif
// no post
diff --git a/odb/mssql/details/export.hxx b/odb/mssql/details/export.hxx
index 694ceb4..98d2057 100644
--- a/odb/mssql/details/export.hxx
+++ b/odb/mssql/details/export.hxx
@@ -9,6 +9,43 @@
#include <odb/mssql/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_MSSQL_BUILD2
+
+#if defined(LIBODB_MSSQL_STATIC) // Using static.
+# define LIBODB_MSSQL_EXPORT
+#elif defined(LIBODB_MSSQL_STATIC_BUILD) // Building static.
+# define LIBODB_MSSQL_EXPORT
+#elif defined(LIBODB_MSSQL_SHARED) // Using shared.
+# ifdef _WIN32
+# define LIBODB_MSSQL_EXPORT __declspec(dllimport)
+# else
+# define LIBODB_MSSQL_EXPORT
+# endif
+#elif defined(LIBODB_MSSQL_SHARED_BUILD) // Building shared.
+# ifdef _WIN32
+# define LIBODB_MSSQL_EXPORT __declspec(dllexport)
+# else
+# define LIBODB_MSSQL_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_MSSQL_EXPORT // Using static or shared.
+#endif
+
+#else // LIBODB_MSSQL_BUILD2
+
#ifdef LIBODB_MSSQL_STATIC_LIB
# define LIBODB_MSSQL_EXPORT
#else
@@ -35,6 +72,8 @@
# endif
#endif
+#endif // LIBODB_MSSQL_BUILD2
+
#include <odb/post.hxx>
#endif // ODB_MSSQL_DETAILS_EXPORT_HXX