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/printer_data.c b/src/printer_data.c
index a8e9f80..ea330c7 100644
--- a/src/printer_data.c
+++ b/src/printer_data.c
@@ -47,7 +47,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_print_all(struct ly_out *out, const struct lyd_node *root, LYD_FORMAT format, uint32_t options)
{
LY_CHECK_ARG_RET(NULL, out, !(options & LYD_PRINT_WITHSIBLINGS), LY_EINVAL);
@@ -71,7 +71,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_print_tree(struct ly_out *out, const struct lyd_node *root, LYD_FORMAT format, uint32_t options)
{
LY_CHECK_ARG_RET(NULL, out, !(options & LYD_PRINT_WITHSIBLINGS), LY_EINVAL);
@@ -85,7 +85,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_print_mem(char **strp, const struct lyd_node *root, LYD_FORMAT format, uint32_t options)
{
LY_ERR ret;
@@ -102,7 +102,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_print_fd(int fd, const struct lyd_node *root, LYD_FORMAT format, uint32_t options)
{
LY_ERR ret;
@@ -116,7 +116,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_print_file(FILE *f, const struct lyd_node *root, LYD_FORMAT format, uint32_t options)
{
LY_ERR ret;
@@ -130,7 +130,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_print_path(const char *path, const struct lyd_node *root, LYD_FORMAT format, uint32_t options)
{
LY_ERR ret;
@@ -144,7 +144,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_print_clb(ly_write_clb writeclb, void *user_data, const struct lyd_node *root, LYD_FORMAT format, uint32_t options)
{
LY_ERR ret;