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/out.c b/src/out.c
index 3272d80..868e711 100644
--- a/src/out.c
+++ b/src/out.c
@@ -89,14 +89,14 @@
     return 1;
 }
 
-API LY_OUT_TYPE
+LIBYANG_API_DEF LY_OUT_TYPE
 ly_out_type(const struct ly_out *out)
 {
     LY_CHECK_ARG_RET(NULL, out, LY_OUT_ERROR);
     return out->type;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_out_new_clb(ly_write_clb writeclb, void *user_data, struct ly_out **out)
 {
     LY_CHECK_ARG_RET(NULL, out, writeclb, LY_EINVAL);
@@ -111,7 +111,7 @@
     return LY_SUCCESS;
 }
 
-API ly_write_clb
+LIBYANG_API_DEF ly_write_clb
 ly_out_clb(struct ly_out *out, ly_write_clb writeclb)
 {
     ly_write_clb prev_clb;
@@ -127,7 +127,7 @@
     return prev_clb;
 }
 
-API void *
+LIBYANG_API_DEF void *
 ly_out_clb_arg(struct ly_out *out, void *arg)
 {
     void *prev_arg;
@@ -143,7 +143,7 @@
     return prev_arg;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_out_new_fd(int fd, struct ly_out **out)
 {
     LY_CHECK_ARG_RET(NULL, out, fd != -1, LY_EINVAL);
@@ -156,7 +156,7 @@
     return LY_SUCCESS;
 }
 
-API int
+LIBYANG_API_DEF int
 ly_out_fd(struct ly_out *out, int fd)
 {
     int prev_fd;
@@ -198,7 +198,7 @@
     return prev_fd;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_out_new_file(FILE *f, struct ly_out **out)
 {
     LY_CHECK_ARG_RET(NULL, out, f, LY_EINVAL);
@@ -212,7 +212,7 @@
     return LY_SUCCESS;
 }
 
-API FILE *
+LIBYANG_API_DEF FILE *
 ly_out_file(struct ly_out *out, FILE *f)
 {
     FILE *prev_f;
@@ -228,7 +228,7 @@
     return prev_f;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_out_new_memory(char **strp, size_t size, struct ly_out **out)
 {
     LY_CHECK_ARG_RET(NULL, out, strp, LY_EINVAL);
@@ -274,7 +274,7 @@
     return data;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_out_reset(struct ly_out *out)
 {
     LY_CHECK_ARG_RET(NULL, out, LY_EINVAL);
@@ -320,7 +320,7 @@
     return LY_SUCCESS;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_out_new_filepath(const char *filepath, struct ly_out **out)
 {
     LY_CHECK_ARG_RET(NULL, out, filepath, LY_EINVAL);
@@ -340,7 +340,7 @@
     return LY_SUCCESS;
 }
 
-API const char *
+LIBYANG_API_DEF const char *
 ly_out_filepath(struct ly_out *out, const char *filepath)
 {
     FILE *f;
@@ -366,7 +366,7 @@
     return NULL;
 }
 
-API void
+LIBYANG_API_DEF void
 ly_out_free(struct ly_out *out, void (*clb_arg_destructor)(void *arg), ly_bool destroy)
 {
     if (!out) {
@@ -493,7 +493,7 @@
     return ret;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_print(struct ly_out *out, const char *format, ...)
 {
     LY_ERR ret;
@@ -508,7 +508,7 @@
     return ret;
 }
 
-API void
+LIBYANG_API_DEF void
 ly_print_flush(struct ly_out *out)
 {
     switch (out->type) {
@@ -645,7 +645,7 @@
     return ret;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_write(struct ly_out *out, const char *buf, size_t len)
 {
     out->func_printed = 0;
@@ -653,7 +653,7 @@
     return ly_write_(out, buf, len);
 }
 
-API size_t
+LIBYANG_API_DEF size_t
 ly_out_printed(const struct ly_out *out)
 {
     return out->func_printed;