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/in.c b/src/in.c
index 278b77a..9752eff 100644
--- a/src/in.c
+++ b/src/in.c
@@ -50,14 +50,14 @@
 #include "tree_schema.h"
 #include "tree_schema_internal.h"
 
-API LY_IN_TYPE
+LIBYANG_API_DEF LY_IN_TYPE
 ly_in_type(const struct ly_in *in)
 {
     LY_CHECK_ARG_RET(NULL, in, LY_IN_ERROR);
     return in->type;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_in_new_fd(int fd, struct ly_in **in)
 {
     size_t length;
@@ -83,7 +83,7 @@
     return LY_SUCCESS;
 }
 
-API int
+LIBYANG_API_DEF int
 ly_in_fd(struct ly_in *in, int fd)
 {
     int prev_fd;
@@ -112,7 +112,7 @@
     return prev_fd;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_in_new_file(FILE *f, struct ly_in **in)
 {
     LY_CHECK_ARG_RET(NULL, f, in, LY_EINVAL);
@@ -126,7 +126,7 @@
     return LY_SUCCESS;
 }
 
-API FILE *
+LIBYANG_API_DEF FILE *
 ly_in_file(struct ly_in *in, FILE *f)
 {
     FILE *prev_f;
@@ -153,7 +153,7 @@
     return prev_f;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_in_new_memory(const char *str, struct ly_in **in)
 {
     LY_CHECK_ARG_RET(NULL, str, in, LY_EINVAL);
@@ -168,7 +168,7 @@
     return LY_SUCCESS;
 }
 
-API const char *
+LIBYANG_API_DEF const char *
 ly_in_memory(struct ly_in *in, const char *str)
 {
     const char *data;
@@ -185,7 +185,7 @@
     return data;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_in_reset(struct ly_in *in)
 {
     LY_CHECK_ARG_RET(NULL, in, LY_EINVAL);
@@ -195,7 +195,7 @@
     return LY_SUCCESS;
 }
 
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
 ly_in_new_filepath(const char *filepath, size_t len, struct ly_in **in)
 {
     LY_ERR ret;
@@ -224,7 +224,7 @@
     return LY_SUCCESS;
 }
 
-API const char *
+LIBYANG_API_DEF const char *
 ly_in_filepath(struct ly_in *in, const char *filepath, size_t len)
 {
     int fd, prev_fd;
@@ -310,7 +310,7 @@
 
 }
 
-API void
+LIBYANG_API_DEF void
 ly_in_free(struct ly_in *in, ly_bool destroy)
 {
     if (!in) {
@@ -363,7 +363,7 @@
     return LY_SUCCESS;
 }
 
-API size_t
+LIBYANG_API_DEF size_t
 ly_in_parsed(const struct ly_in *in)
 {
     return in->current - in->func_start;