diff --git a/include/yaml-cpp/binary.h b/include/yaml-cpp/binary.h index 7a503d9..adb2b36 100644 --- a/include/yaml-cpp/binary.h +++ b/include/yaml-cpp/binary.h @@ -10,11 +10,13 @@ #include #include -namespace YAML { -std::string EncodeBase64(const unsigned char *data, std::size_t size); -std::vector DecodeBase64(const std::string &input); +#include "yaml-cpp/dll.h" -class Binary { +namespace YAML { +YAML_CPP_API std::string EncodeBase64(const unsigned char *data, std::size_t size); +YAML_CPP_API std::vector DecodeBase64(const std::string &input); + +class YAML_CPP_API Binary { public: Binary() : m_unownedData(0), m_unownedSize(0) {} Binary(const unsigned char *data_, std::size_t size_) diff --git a/include/yaml-cpp/node/convert.h b/include/yaml-cpp/node/convert.h index 2c7a40a..65d5c6c 100644 --- a/include/yaml-cpp/node/convert.h +++ b/include/yaml-cpp/node/convert.h @@ -144,7 +144,7 @@ template <> struct convert { static Node encode(bool rhs) { return rhs ? Node("true") : Node("false"); } - static bool decode(const Node& node, bool& rhs); + YAML_CPP_API static bool decode(const Node& node, bool& rhs); }; // std::map diff --git a/include/yaml-cpp/node/detail/memory.h b/include/yaml-cpp/node/detail/memory.h index b5f257f..e3d344b 100644 --- a/include/yaml-cpp/node/detail/memory.h +++ b/include/yaml-cpp/node/detail/memory.h @@ -11,6 +11,7 @@ #include #include +#include "yaml-cpp/dll.h" #include "yaml-cpp/node/ptr.h" namespace YAML { @@ -21,7 +22,7 @@ class node; namespace YAML { namespace detail { -class memory { +class YAML_CPP_API memory { public: node& create_node(); void merge(const memory& rhs); @@ -31,7 +32,7 @@ class memory { Nodes m_nodes; }; -class memory_holder { +class YAML_CPP_API memory_holder { public: memory_holder() : m_pMemory(new memory) {} diff --git a/include/yaml-cpp/node/detail/node_data.h b/include/yaml-cpp/node/detail/node_data.h index f82e332..c1696f4 100644 --- a/include/yaml-cpp/node/detail/node_data.h +++ b/include/yaml-cpp/node/detail/node_data.h @@ -29,7 +29,7 @@ class node; namespace YAML { namespace detail { -class node_data : private boost::noncopyable { +class YAML_CPP_API node_data : private boost::noncopyable { public: node_data(); diff --git a/include/yaml-cpp/node/emit.h b/include/yaml-cpp/node/emit.h index 2e4b98d..7c55af2 100644 --- a/include/yaml-cpp/node/emit.h +++ b/include/yaml-cpp/node/emit.h @@ -10,14 +10,16 @@ #include #include +#include "yaml-cpp/dll.h" + namespace YAML { class Emitter; class Node; -Emitter& operator<<(Emitter& out, const Node& node); -std::ostream& operator<<(std::ostream& out, const Node& node); +YAML_CPP_API Emitter& operator<<(Emitter& out, const Node& node); +YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node); -std::string Dump(const Node& node); +YAML_CPP_API std::string Dump(const Node& node); } #endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/include/yaml-cpp/node/node.h b/include/yaml-cpp/node/node.h index 394750f..8942aa5 100644 --- a/include/yaml-cpp/node/node.h +++ b/include/yaml-cpp/node/node.h @@ -24,7 +24,7 @@ struct iterator_value; } // namespace YAML namespace YAML { -class Node { +class YAML_CPP_API Node { public: friend class NodeBuilder; friend class NodeEvents; @@ -126,9 +126,9 @@ class Node { mutable detail::node* m_pNode; }; -bool operator==(const Node& lhs, const Node& rhs); +YAML_CPP_API bool operator==(const Node& lhs, const Node& rhs); -Node Clone(const Node& node); +YAML_CPP_API Node Clone(const Node& node); template struct convert; diff --git a/include/yaml-cpp/node/parse.h b/include/yaml-cpp/node/parse.h index 4e3cb90..0ea4948 100644 --- a/include/yaml-cpp/node/parse.h +++ b/include/yaml-cpp/node/parse.h @@ -11,18 +11,20 @@ #include #include +#include "yaml-cpp/dll.h" + namespace YAML { class Node; -Node Load(const std::string& input); -Node Load(const char* input); -Node Load(std::istream& input); -Node LoadFile(const std::string& filename); +YAML_CPP_API Node Load(const std::string& input); +YAML_CPP_API Node Load(const char* input); +YAML_CPP_API Node Load(std::istream& input); +YAML_CPP_API Node LoadFile(const std::string& filename); -std::vector LoadAll(const std::string& input); -std::vector LoadAll(const char* input); -std::vector LoadAll(std::istream& input); -std::vector LoadAllFromFile(const std::string& filename); +YAML_CPP_API std::vector LoadAll(const std::string& input); +YAML_CPP_API std::vector LoadAll(const char* input); +YAML_CPP_API std::vector LoadAll(std::istream& input); +YAML_CPP_API std::vector LoadAllFromFile(const std::string& filename); } #endif // VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/include/yaml-cpp/ostream_wrapper.h b/include/yaml-cpp/ostream_wrapper.h index cc2ef56..1f0a080 100644 --- a/include/yaml-cpp/ostream_wrapper.h +++ b/include/yaml-cpp/ostream_wrapper.h @@ -10,8 +10,10 @@ #include #include +#include "yaml-cpp/dll.h" + namespace YAML { -class ostream_wrapper { +class YAML_CPP_API ostream_wrapper { public: ostream_wrapper(); explicit ostream_wrapper(std::ostream& stream); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f2fd67e..dcdab35 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,7 +1,13 @@ +set(gtest_force_shared_crt ${MSVC_SHARED_RT} CACHE BOOL + "Use shared (DLL) run-time lib even when Google Test built as a static lib.") add_subdirectory(gmock-1.7.0) include_directories(gmock-1.7.0/gtest/include) include_directories(gmock-1.7.0/include) +if(WIN32 AND BUILD_SHARED_LIBS) + add_definitions("-DGTEST_LINKED_AS_SHARED_LIBRARY") +endif() + file(GLOB test_headers [a-z_]*.h) file(GLOB test_sources [a-z_]*.cpp integration/[a-z_]*.cpp node/[a-z_]*.cpp) file(GLOB test_new_api_sources new-api/[a-z]*.cpp)