MSVC: handle symbol visibility

On MSVC, the exported symbols have to be marked both in the header and
in the implementation as dllexport, whereas on GCC the visibility=normal
attribute is only supposed to be used in the implementation. As a
result, we need two types of macros here, one for the public headers,
and the other for TUs with implementation. Also, the symbol name cannot
be generic ("API") because we only want to mark as dllexport those
symbols which are in a library that we're building *now*. Otherwise this
will break havoc in any libraries which also use the `ABI` macro *and*
also use libyang.
diff --git a/src/set.c b/src/set.c
index ecf3dae..d4836b8 100644
--- a/src/set.c
+++ b/src/set.c
@@ -21,7 +21,7 @@
 #include "log.h"
 #include "set.h"
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_set_new(struct ly_set **set_p)
 {
     LY_CHECK_ARG_RET(NULL, set_p, LY_EINVAL);
@@ -32,7 +32,7 @@
     return LY_SUCCESS;
 }
 
-API void
+LIBYANG_API_DEF void
 ly_set_clean(struct ly_set *set, void (*destructor)(void *obj))
 {
     uint32_t u;
@@ -49,7 +49,7 @@
     set->count = 0;
 }
 
-API void
+LIBYANG_API_DEF void
 ly_set_erase(struct ly_set *set, void (*destructor)(void *obj))
 {
     if (!set) {
@@ -63,7 +63,7 @@
     set->objs = NULL;
 }
 
-API void
+LIBYANG_API_DEF void
 ly_set_free(struct ly_set *set, void (*destructor)(void *obj))
 {
     if (!set) {
@@ -75,7 +75,7 @@
     free(set);
 }
 
-API ly_bool
+LIBYANG_API_DEF ly_bool
 ly_set_contains(const struct ly_set *set, void *object, uint32_t *index_p)
 {
     LY_CHECK_ARG_RET(NULL, set, 0);
@@ -94,7 +94,7 @@
     return 0;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_set_dup(const struct ly_set *set, void *(*duplicator)(void *obj), struct ly_set **newset_p)
 {
     struct ly_set *newset;
@@ -125,7 +125,7 @@
     return LY_SUCCESS;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_set_add(struct ly_set *set, void *object, ly_bool list, uint32_t *index_p)
 {
     void **new;
@@ -162,7 +162,7 @@
     return LY_SUCCESS;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_set_merge(struct ly_set *trg, const struct ly_set *src, ly_bool list, void *(*duplicator)(void *obj))
 {
     uint32_t u;
@@ -187,7 +187,7 @@
     return LY_SUCCESS;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_set_rm_index(struct ly_set *set, uint32_t index, void (*destructor)(void *obj))
 {
     LY_CHECK_ARG_RET(NULL, set, LY_EINVAL);
@@ -209,7 +209,7 @@
     return LY_SUCCESS;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_set_rm(struct ly_set *set, void *object, void (*destructor)(void *obj))
 {
     uint32_t i;