aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-07-26 22:36:33 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-07-28 19:44:42 +0300
commit6597c9b777b608a96974b4a7a8c15234b05ffdd8 (patch)
tree59f588c71ffdf7069e5c765a8ddf5f93610e7e4f
parent2ddc00326a9d6b647e7213212d0241a60be68256 (diff)
Cleanup DLL export/import
-rw-r--r--butl/buildfile4
-rw-r--r--butl/export8
-rw-r--r--butl/filesystem4
-rw-r--r--butl/filesystem.ixx24
-rw-r--r--butl/process2
-rw-r--r--butl/string-table2
-rw-r--r--butl/utility4
7 files changed, 32 insertions, 16 deletions
diff --git a/butl/buildfile b/butl/buildfile
index 7a3c442..d2d16ac 100644
--- a/butl/buildfile
+++ b/butl/buildfile
@@ -34,8 +34,8 @@ cxx.poptions =+ -I$src_root
lib{butl}: cxx.export.poptions = -I$src_root
-liba{hello}: cxx.export.poptions += -DLIBBUTL_STATIC
-libs{hello}: cxx.export.poptions += -DLIBBUTL_SHARED
+liba{butl}: cxx.export.poptions += -DLIBBUTL_STATIC
+libs{butl}: cxx.export.poptions += -DLIBBUTL_SHARED
obja{*}: cxx.poptions += -DLIBBUTL_STATIC_BUILD
objs{*}: cxx.poptions += -DLIBBUTL_SHARED_BUILD
diff --git a/butl/export b/butl/export
index 2b5a5ac..bd7f188 100644
--- a/butl/export
+++ b/butl/export
@@ -6,8 +6,12 @@
#define BUTL_EXPORT
// Normally we don't export class templates (but do complete specializations),
-// inline functions, and classes without any member functions. But in the end
-// it's all trial and error to figure out what VC needs exported.
+// inline functions, and classes with only inline member functions. Exporting
+// classes that inherit from non-exported/import 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.
#if defined(LIBBUTL_STATIC) // Using static.
# define LIBBUTL_EXPORT
diff --git a/butl/filesystem b/butl/filesystem
index 2c4f3a4..566f398 100644
--- a/butl/filesystem
+++ b/butl/filesystem
@@ -355,8 +355,8 @@ namespace butl
// for (...: i) ...
// ++i; // Invalid.
//
- inline dir_iterator begin (dir_iterator& i) {return std::move (i);}
- inline dir_iterator end (const dir_iterator&) {return dir_iterator ();}
+ inline dir_iterator begin (dir_iterator&);
+ inline dir_iterator end (const dir_iterator&);
}
#include <butl/filesystem.ixx>
diff --git a/butl/filesystem.ixx b/butl/filesystem.ixx
index 8e81b59..af1125e 100644
--- a/butl/filesystem.ixx
+++ b/butl/filesystem.ixx
@@ -85,6 +85,12 @@ namespace butl
// dir_entry
//
inline entry_type dir_entry::
+ ltype () const
+ {
+ return t_ != entry_type::unknown ? t_ : (t_ = type (false));
+ }
+
+ inline entry_type dir_entry::
type () const
{
entry_type t (ltype ());
@@ -93,12 +99,6 @@ namespace butl
: lt_ != entry_type::unknown ? lt_ : (lt_ = type (true));
}
- inline entry_type dir_entry::
- ltype () const
- {
- return t_ != entry_type::unknown ? t_ : (t_ = type (false));
- }
-
// dir_iterator
//
inline dir_iterator::
@@ -123,4 +123,16 @@ namespace butl
{
return !(x == y);
}
+
+ inline dir_iterator
+ begin (dir_iterator& i)
+ {
+ return std::move (i);
+ }
+
+ inline dir_iterator
+ end (const dir_iterator&)
+ {
+ return dir_iterator ();
+ }
}
diff --git a/butl/process b/butl/process
index fc8c1e8..ed9f798 100644
--- a/butl/process
+++ b/butl/process
@@ -17,7 +17,7 @@
namespace butl
{
- struct LIBBUTL_EXPORT process_error: std::system_error
+ struct process_error: std::system_error
{
bool
child () const {return child_;}
diff --git a/butl/string-table b/butl/string-table
index cf2a20b..ae34419 100644
--- a/butl/string-table
+++ b/butl/string-table
@@ -38,7 +38,7 @@ namespace butl
struct string_table_traits;
template <>
- struct LIBBUTL_EXPORT string_table_traits<std::string>
+ struct string_table_traits<std::string>
{
static const std::string&
key (const std::string& d) {return d;}
diff --git a/butl/utility b/butl/utility
index 2436616..101d503 100644
--- a/butl/utility
+++ b/butl/utility
@@ -15,7 +15,7 @@ namespace butl
{
// Key comparators (i.e., to be used in sets, maps, etc).
//
- struct LIBBUTL_EXPORT compare_c_string
+ struct compare_c_string
{
bool operator() (const char* x, const char* y) const
{
@@ -23,7 +23,7 @@ namespace butl
}
};
- struct LIBBUTL_EXPORT compare_pointer_target
+ struct compare_pointer_target
{
template <typename P>
bool operator() (const P& x, const P& y) const {return *x < *y;}