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/common.h b/src/common.h
index 19b21b8..4430962 100644
--- a/src/common.h
+++ b/src/common.h
@@ -21,6 +21,7 @@
#include <string.h>
#include "compat.h"
+#include "config.h"
#include "context.h"
#include "hash_table.h"
#include "log.h"
@@ -51,13 +52,6 @@
#define GETMACRO5(_1, _2, _3, _4, _5, NAME, ...) NAME
#define GETMACRO6(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
-/*
- * If the compiler supports attribute to mark objects as hidden, mark all
- * objects as hidden and export only objects explicitly marked to be part of
- * the public API.
- */
-#define API __attribute__((visibility("default")))
-
/******************************************************************************
* Logger
*****************************************************************************/
diff --git a/src/config.h.in b/src/config.h.in
index de9c40c..9915a83 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -35,4 +35,28 @@
# define _FORMAT_PRINTF(FORM, ARGS)
#endif
+/** Exporting symbols to a shared library and importing back afterwards
+ *
+ * - use LIBYANG_API_DECL to mark a declaration in the public header
+ * - use LIBYANG_API_DEF to mark a definition (in the source code for the actual implementaiton)
+ * */
+#ifdef _MSC_VER
+# ifndef STATIC
+# define LIBYANG_API_DEF __declspec(dllexport)
+# ifdef LIBYANG_BUILD
+# define LIBYANG_API_DECL __declspec(dllexport)
+# else
+# define LIBYANG_API_DECL __declspec(dllimport)
+# endif
+# endif
+#else
+/*
+ * If the compiler supports attribute to mark objects as hidden, mark all
+ * objects as hidden and export only objects explicitly marked to be part of
+ * the public API.
+ */
+# define LIBYANG_API_DEF __attribute__((visibility("default")))
+# define LIBYANG_API_DECL
+#endif
+
#endif /* LY_CONFIG_H_ */
diff --git a/src/context.c b/src/context.c
index 99f57fa..28a72f1 100644
--- a/src/context.c
+++ b/src/context.c
@@ -73,7 +73,7 @@
#define LY_INTERNAL_MODS_COUNT sizeof(internal_modules) / sizeof(struct internal_modules_s)
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_ctx_set_searchdir(struct ly_ctx *ctx, const char *search_dir)
{
struct stat st;
@@ -120,7 +120,7 @@
}
}
-API const char * const *
+LIBYANG_API_DEF const char * const *
ly_ctx_get_searchdirs(const struct ly_ctx *ctx)
{
#define LY_CTX_SEARCHDIRS_SIZE_STEP 8
@@ -142,7 +142,7 @@
return (const char * const *)ctx->search_paths.objs;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_ctx_unset_searchdir(struct ly_ctx *ctx, const char *value)
{
LY_CHECK_ARG_RET(ctx, ctx, LY_EINVAL);
@@ -175,7 +175,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_ctx_unset_searchdir_last(struct ly_ctx *ctx, uint32_t count)
{
LY_CHECK_ARG_RET(ctx, ctx, LY_EINVAL);
@@ -187,7 +187,7 @@
return LY_SUCCESS;
}
-API struct lys_module *
+LIBYANG_API_DEF struct lys_module *
ly_ctx_load_module(struct ly_ctx *ctx, const char *name, const char *revision, const char **features)
{
struct lys_module *mod = NULL;
@@ -223,7 +223,7 @@
return mod;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_ctx_new(const char *search_dir, uint16_t options, struct ly_ctx **new_ctx)
{
struct ly_ctx *ctx = NULL;
@@ -490,21 +490,21 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_ctx_new_ylpath(const char *search_dir, const char *path, LYD_FORMAT format, int options, struct ly_ctx **ctx)
{
LY_CHECK_ARG_RET(NULL, path, ctx, LY_EINVAL);
return ly_ctx_new_yl_common(search_dir, path, format, options, lyd_parse_data_path, ctx);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_ctx_new_ylmem(const char *search_dir, const char *data, LYD_FORMAT format, int options, struct ly_ctx **ctx)
{
LY_CHECK_ARG_RET(NULL, data, ctx, LY_EINVAL);
return ly_ctx_new_yl_common(search_dir, data, format, options, lyd_parse_data_mem, ctx);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_ctx_compile(struct ly_ctx *ctx)
{
LY_ERR ret = LY_SUCCESS;
@@ -526,7 +526,7 @@
return ret;
}
-API uint16_t
+LIBYANG_API_DEF uint16_t
ly_ctx_get_options(const struct ly_ctx *ctx)
{
LY_CHECK_ARG_RET(ctx, ctx, 0);
@@ -534,7 +534,7 @@
return ctx->flags;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_ctx_set_options(struct ly_ctx *ctx, uint16_t option)
{
LY_ERR lyrc = LY_SUCCESS;
@@ -609,7 +609,7 @@
}
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_ctx_unset_options(struct ly_ctx *ctx, uint16_t option)
{
LY_CHECK_ARG_RET(ctx, ctx, LY_EINVAL);
@@ -631,7 +631,7 @@
return LY_SUCCESS;
}
-API uint16_t
+LIBYANG_API_DEF uint16_t
ly_ctx_get_change_count(const struct ly_ctx *ctx)
{
LY_CHECK_ARG_RET(ctx, ctx, 0);
@@ -639,7 +639,7 @@
return ctx->change_count;
}
-API void
+LIBYANG_API_DEF void
ly_ctx_set_module_imp_clb(struct ly_ctx *ctx, ly_module_imp_clb clb, void *user_data)
{
LY_CHECK_ARG_RET(ctx, ctx, );
@@ -648,7 +648,7 @@
ctx->imp_clb_data = user_data;
}
-API ly_module_imp_clb
+LIBYANG_API_DEF ly_module_imp_clb
ly_ctx_get_module_imp_clb(const struct ly_ctx *ctx, void **user_data)
{
LY_CHECK_ARG_RET(ctx, ctx, NULL);
@@ -659,7 +659,7 @@
return ctx->imp_clb;
}
-API struct lys_module *
+LIBYANG_API_DEF struct lys_module *
ly_ctx_get_module_iter(const struct ly_ctx *ctx, uint32_t *index)
{
LY_CHECK_ARG_RET(ctx, ctx, index, NULL);
@@ -735,14 +735,14 @@
return NULL;
}
-API struct lys_module *
+LIBYANG_API_DEF struct lys_module *
ly_ctx_get_module_ns(const struct ly_ctx *ctx, const char *ns, const char *revision)
{
LY_CHECK_ARG_RET(ctx, ctx, ns, NULL);
return ly_ctx_get_module_by(ctx, ns, offsetof(struct lys_module, ns), revision);
}
-API struct lys_module *
+LIBYANG_API_DEF struct lys_module *
ly_ctx_get_module(const struct ly_ctx *ctx, const char *name, const char *revision)
{
LY_CHECK_ARG_RET(ctx, ctx, name, NULL);
@@ -771,14 +771,14 @@
return NULL;
}
-API struct lys_module *
+LIBYANG_API_DEF struct lys_module *
ly_ctx_get_module_latest(const struct ly_ctx *ctx, const char *name)
{
LY_CHECK_ARG_RET(ctx, ctx, name, NULL);
return ly_ctx_get_module_latest_by(ctx, name, offsetof(struct lys_module, name));
}
-API struct lys_module *
+LIBYANG_API_DEF struct lys_module *
ly_ctx_get_module_latest_ns(const struct ly_ctx *ctx, const char *ns)
{
LY_CHECK_ARG_RET(ctx, ctx, ns, NULL);
@@ -808,7 +808,7 @@
return NULL;
}
-API struct lys_module *
+LIBYANG_API_DEF struct lys_module *
ly_ctx_get_module_implemented(const struct ly_ctx *ctx, const char *name)
{
LY_CHECK_ARG_RET(ctx, ctx, name, NULL);
@@ -822,7 +822,7 @@
return ly_ctx_get_module_implemented_by(ctx, name, name_len, offsetof(struct lys_module, name));
}
-API struct lys_module *
+LIBYANG_API_DEF struct lys_module *
ly_ctx_get_module_implemented_ns(const struct ly_ctx *ctx, const char *ns)
{
LY_CHECK_ARG_RET(ctx, ctx, ns, NULL);
@@ -899,31 +899,31 @@
return submod;
}
-API const struct lysp_submodule *
+LIBYANG_API_DEF const struct lysp_submodule *
ly_ctx_get_submodule(const struct ly_ctx *ctx, const char *submodule, const char *revision)
{
return _ly_ctx_get_submodule(ctx, submodule, revision, 0);
}
-API const struct lysp_submodule *
+LIBYANG_API_DEF const struct lysp_submodule *
ly_ctx_get_submodule_latest(const struct ly_ctx *ctx, const char *submodule)
{
return _ly_ctx_get_submodule(ctx, submodule, NULL, 1);
}
-API const struct lysp_submodule *
+LIBYANG_API_DEF const struct lysp_submodule *
ly_ctx_get_submodule2(const struct lys_module *module, const char *submodule, const char *revision)
{
return _ly_ctx_get_submodule2(module, submodule, revision, 0);
}
-API const struct lysp_submodule *
+LIBYANG_API_DEF const struct lysp_submodule *
ly_ctx_get_submodule2_latest(const struct lys_module *module, const char *submodule)
{
return _ly_ctx_get_submodule2(module, submodule, NULL, 1);
}
-API void
+LIBYANG_API_DEF void
ly_ctx_reset_latests(struct ly_ctx *ctx)
{
struct lys_module *mod;
@@ -945,7 +945,7 @@
}
}
-API uint32_t
+LIBYANG_API_DEF uint32_t
ly_ctx_internal_modules_count(const struct ly_ctx *ctx)
{
if (!ctx) {
@@ -1053,7 +1053,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_ctx_get_yanglib_data(const struct ly_ctx *ctx, struct lyd_node **root_p, const char *content_id_format, ...)
{
LY_ERR ret;
@@ -1202,7 +1202,7 @@
return ret;
}
-API void
+LIBYANG_API_DEF void
ly_ctx_destroy(struct ly_ctx *ctx)
{
struct lys_module *mod;
diff --git a/src/context.h b/src/context.h
index 553892f..1859236 100644
--- a/src/context.h
+++ b/src/context.h
@@ -220,7 +220,7 @@
* @param[out] new_ctx Pointer to the created libyang context if LY_SUCCESS returned.
* @return LY_ERR return value.
*/
-LY_ERR ly_ctx_new(const char *search_dir, uint16_t options, struct ly_ctx **new_ctx);
+LIBYANG_API_DECL LY_ERR ly_ctx_new(const char *search_dir, uint16_t options, struct ly_ctx **new_ctx);
/**
* @brief Create libyang context according to the content of the given yang-library data.
@@ -243,7 +243,7 @@
* @param[out] ctx Pointer to the created libyang context if LY_SUCCESS returned.
* @return LY_ERR return value
*/
-LY_ERR ly_ctx_new_ylpath(const char *search_dir, const char *path, LYD_FORMAT format, int options, struct ly_ctx **ctx);
+LIBYANG_API_DECL LY_ERR ly_ctx_new_ylpath(const char *search_dir, const char *path, LYD_FORMAT format, int options, struct ly_ctx **ctx);
/**
* @brief Create libyang context according to the content of the given yang-library data.
@@ -266,7 +266,7 @@
* @param[out] ctx Pointer to the created libyang context if LY_SUCCESS returned.
* @return LY_ERR return value
*/
-LY_ERR ly_ctx_new_ylmem(const char *search_dir, const char *data, LYD_FORMAT format, int options, struct ly_ctx **ctx);
+LIBYANG_API_DECL LY_ERR ly_ctx_new_ylmem(const char *search_dir, const char *data, LYD_FORMAT format, int options, struct ly_ctx **ctx);
/**
* @brief Compile (recompile) the context applying all the performed changes after the last context compilation.
@@ -275,7 +275,7 @@
* @param[in] ctx Context to compile.
* @return LY_ERR return value.
*/
-LY_ERR ly_ctx_compile(struct ly_ctx *ctx);
+LIBYANG_API_DECL LY_ERR ly_ctx_compile(struct ly_ctx *ctx);
/**
* @brief Add the search path into libyang context
@@ -287,7 +287,7 @@
* @param[in] search_dir New search path to add to the current paths previously set in ctx.
* @return LY_ERR return value.
*/
-LY_ERR ly_ctx_set_searchdir(struct ly_ctx *ctx, const char *search_dir);
+LIBYANG_API_DECL LY_ERR ly_ctx_set_searchdir(struct ly_ctx *ctx, const char *search_dir);
/**
* @brief Clean the search path(s) from the libyang context
@@ -298,7 +298,7 @@
* @param[in] value Searchdir to be removed, use NULL to remove them all.
* @return LY_ERR return value
*/
-LY_ERR ly_ctx_unset_searchdir(struct ly_ctx *ctx, const char *value);
+LIBYANG_API_DECL LY_ERR ly_ctx_unset_searchdir(struct ly_ctx *ctx, const char *value);
/**
* @brief Remove the least recently added search path(s) from the libyang context.
@@ -311,7 +311,7 @@
* Value 0 does not change the search path set.
* @return LY_ERR return value
*/
-LY_ERR ly_ctx_unset_searchdir_last(struct ly_ctx *ctx, uint32_t count);
+LIBYANG_API_DECL LY_ERR ly_ctx_unset_searchdir_last(struct ly_ctx *ctx, uint32_t count);
/**
* @brief Get the NULL-terminated list of the search paths in libyang context. Do not modify the result!
@@ -320,7 +320,7 @@
* @return NULL-terminated list (array) of the search paths, NULL if no searchpath was set.
* Do not modify the provided data in any way!
*/
-const char * const *ly_ctx_get_searchdirs(const struct ly_ctx *ctx);
+LIBYANG_API_DECL const char * const *ly_ctx_get_searchdirs(const struct ly_ctx *ctx);
/**
* @brief Get the currently set context's options.
@@ -328,7 +328,7 @@
* @param[in] ctx Context to query.
* @return Combination of all the currently set context's options, see @ref contextoptions.
*/
-uint16_t ly_ctx_get_options(const struct ly_ctx *ctx);
+LIBYANG_API_DECL uint16_t ly_ctx_get_options(const struct ly_ctx *ctx);
/**
* @brief Set some of the context's options, see @ref contextoptions.
@@ -338,7 +338,7 @@
* and all ::lysc_node.priv in the modules will be overwritten, see ::LY_CTX_SET_PRIV_PARSED.
* @return LY_ERR value.
*/
-LY_ERR ly_ctx_set_options(struct ly_ctx *ctx, uint16_t option);
+LIBYANG_API_DECL LY_ERR ly_ctx_set_options(struct ly_ctx *ctx, uint16_t option);
/**
* @brief Unset some of the context's options, see @ref contextoptions.
@@ -346,7 +346,7 @@
* @param[in] option Combination of the context's options to be unset, see @ref contextoptions.
* @return LY_ERR value.
*/
-LY_ERR ly_ctx_unset_options(struct ly_ctx *ctx, uint16_t option);
+LIBYANG_API_DECL LY_ERR ly_ctx_unset_options(struct ly_ctx *ctx, uint16_t option);
/**
* @brief Get the change count of the context (module set) during its life-time.
@@ -354,7 +354,7 @@
* @param[in] ctx Context to be examined.
* @return Context change count.
*/
-uint16_t ly_ctx_get_change_count(const struct ly_ctx *ctx);
+LIBYANG_API_DECL uint16_t ly_ctx_get_change_count(const struct ly_ctx *ctx);
/**
* @brief Callback for freeing returned module data in #ly_module_imp_clb.
@@ -396,7 +396,7 @@
* @param[in] user_data Optional pointer for getting the user-supplied callback data.
* @return Callback or NULL if not set.
*/
-ly_module_imp_clb ly_ctx_get_module_imp_clb(const struct ly_ctx *ctx, void **user_data);
+LIBYANG_API_DECL ly_module_imp_clb ly_ctx_get_module_imp_clb(const struct ly_ctx *ctx, void **user_data);
/**
* @brief Set missing include or import module callback. It is meant to be used when the models
@@ -407,7 +407,7 @@
* @param[in] clb Callback responsible for returning the missing model.
* @param[in] user_data Arbitrary data that will always be passed to the callback \p clb.
*/
-void ly_ctx_set_module_imp_clb(struct ly_ctx *ctx, ly_module_imp_clb clb, void *user_data);
+LIBYANG_API_DECL void ly_ctx_set_module_imp_clb(struct ly_ctx *ctx, ly_module_imp_clb clb, void *user_data);
/**
* @brief Get YANG module of the given name and revision.
@@ -418,7 +418,7 @@
* the schema with no revision is returned, if it is present in the context.
* @return Pointer to the YANG module, NULL if no schema in the context follows the name and revision requirements.
*/
-struct lys_module *ly_ctx_get_module(const struct ly_ctx *ctx, const char *name, const char *revision);
+LIBYANG_API_DECL struct lys_module *ly_ctx_get_module(const struct ly_ctx *ctx, const char *name, const char *revision);
/**
* @brief Get the latest revision of the YANG module specified by its name.
@@ -430,7 +430,7 @@
* @return The latest revision of the specified YANG module in the given context, NULL if no YANG module of the
* given name is present in the context.
*/
-struct lys_module *ly_ctx_get_module_latest(const struct ly_ctx *ctx, const char *name);
+LIBYANG_API_DECL struct lys_module *ly_ctx_get_module_latest(const struct ly_ctx *ctx, const char *name);
/**
* @brief Get the (only) implemented YANG module specified by its name.
@@ -440,7 +440,7 @@
* @return The only implemented YANG module revision of the given name in the given context. NULL if there is no
* implemented module of the given name.
*/
-struct lys_module *ly_ctx_get_module_implemented(const struct ly_ctx *ctx, const char *name);
+LIBYANG_API_DECL struct lys_module *ly_ctx_get_module_implemented(const struct ly_ctx *ctx, const char *name);
/**
* @brief Iterate over all modules in the given context.
@@ -451,7 +451,7 @@
* to be used in all calls starting with value 0.
* @return Next context module, NULL if the last was already returned.
*/
-struct lys_module *ly_ctx_get_module_iter(const struct ly_ctx *ctx, uint32_t *index);
+LIBYANG_API_DECL struct lys_module *ly_ctx_get_module_iter(const struct ly_ctx *ctx, uint32_t *index);
/**
* @brief Get YANG module of the given namespace and revision.
@@ -462,7 +462,7 @@
* the schema with no revision is returned, if it is present in the context.
* @return Pointer to the YANG module, NULL if no schema in the context follows the namespace and revision requirements.
*/
-struct lys_module *ly_ctx_get_module_ns(const struct ly_ctx *ctx, const char *ns, const char *revision);
+LIBYANG_API_DECL struct lys_module *ly_ctx_get_module_ns(const struct ly_ctx *ctx, const char *ns, const char *revision);
/**
* @brief Get the latest revision of the YANG module specified by its namespace.
@@ -474,7 +474,7 @@
* @return The latest revision of the specified YANG module in the given context, NULL if no YANG module of the
* given namespace is present in the context.
*/
-struct lys_module *ly_ctx_get_module_latest_ns(const struct ly_ctx *ctx, const char *ns);
+LIBYANG_API_DECL struct lys_module *ly_ctx_get_module_latest_ns(const struct ly_ctx *ctx, const char *ns);
/**
* @brief Get the (only) implemented YANG module specified by its namespace.
@@ -484,7 +484,7 @@
* @return The only implemented YANG module revision of the given namespace in the given context. NULL if there is no
* implemented module of the given namespace.
*/
-struct lys_module *ly_ctx_get_module_implemented_ns(const struct ly_ctx *ctx, const char *ns);
+LIBYANG_API_DECL struct lys_module *ly_ctx_get_module_implemented_ns(const struct ly_ctx *ctx, const char *ns);
/**
* @brief Get a specific submodule from context. If its belongs-to module is known, use ::ly_ctx_get_submodule2().
@@ -494,7 +494,7 @@
* @param[in] revision Revision of the submodule to find, NULL for a submodule without a revision.
* @return Found submodule, NULL if there is none.
*/
-const struct lysp_submodule *ly_ctx_get_submodule(const struct ly_ctx *ctx, const char *submodule, const char *revision);
+LIBYANG_API_DECL const struct lysp_submodule *ly_ctx_get_submodule(const struct ly_ctx *ctx, const char *submodule, const char *revision);
/**
* @brief Get the latests revision of a submodule from context. If its belongs-to module is known,
@@ -504,7 +504,7 @@
* @param[in] submodule Submodule name to find.
* @return Found submodule, NULL if there is none.
*/
-const struct lysp_submodule *ly_ctx_get_submodule_latest(const struct ly_ctx *ctx, const char *submodule);
+LIBYANG_API_DECL const struct lysp_submodule *ly_ctx_get_submodule_latest(const struct ly_ctx *ctx, const char *submodule);
/**
* @brief Get a specific submodule from a module. If the belongs-to module is not known, use ::ly_ctx_get_submodule().
@@ -514,7 +514,7 @@
* @param[in] revision Revision of the submodule to find, NULL for a submodule without a revision.
* @return Found submodule, NULL if there is none.
*/
-const struct lysp_submodule *ly_ctx_get_submodule2(const struct lys_module *module, const char *submodule,
+LIBYANG_API_DECL const struct lysp_submodule *ly_ctx_get_submodule2(const struct lys_module *module, const char *submodule,
const char *revision);
/**
@@ -525,7 +525,7 @@
* @param[in] submodule Submodule name to find.
* @return Found submodule, NULL if there is none.
*/
-const struct lysp_submodule *ly_ctx_get_submodule2_latest(const struct lys_module *module, const char *submodule);
+LIBYANG_API_DECL const struct lysp_submodule *ly_ctx_get_submodule2_latest(const struct lys_module *module, const char *submodule);
/**
* @brief Reset cached latest revision information of the schemas in the context.
@@ -544,7 +544,7 @@
*
* @param[in] ctx libyang context where the latest revision information is going to be reset.
*/
-void ly_ctx_reset_latests(struct ly_ctx *ctx);
+LIBYANG_API_DECL void ly_ctx_reset_latests(struct ly_ctx *ctx);
/**
* @brief Learn the number of internal modules of a context. Internal modules
@@ -553,7 +553,7 @@
* @param[in] ctx libyang context to examine.
* @return Number of internal modules.
*/
-uint32_t ly_ctx_internal_modules_count(const struct ly_ctx *ctx);
+LIBYANG_API_DECL uint32_t ly_ctx_internal_modules_count(const struct ly_ctx *ctx);
/**
* @brief Try to find the model in the searchpaths of \p ctx and load it into it. If custom missing
@@ -574,7 +574,7 @@
* with the current features settings in case the module is already present in the context.
* @return Pointer to the data model structure, NULL if not found or some error occurred.
*/
-struct lys_module *ly_ctx_load_module(struct ly_ctx *ctx, const char *name, const char *revision, const char **features);
+LIBYANG_API_DECL struct lys_module *ly_ctx_load_module(struct ly_ctx *ctx, const char *name, const char *revision, const char **features);
/**
* @brief Get data of the internal ietf-yang-library module with information about all the loaded modules.
@@ -596,7 +596,7 @@
* @param[in] ... Parameters for @p content_id_format.
* @return LY_ERR value
*/
-LY_ERR ly_ctx_get_yanglib_data(const struct ly_ctx *ctx, struct lyd_node **root, const char *content_id_format, ...);
+LIBYANG_API_DECL LY_ERR ly_ctx_get_yanglib_data(const struct ly_ctx *ctx, struct lyd_node **root, const char *content_id_format, ...);
/**
* @brief Free all internal structures of the specified context.
@@ -613,7 +613,7 @@
*
* @param[in] ctx libyang context to destroy
*/
-void ly_ctx_destroy(struct ly_ctx *ctx);
+LIBYANG_API_DECL void ly_ctx_destroy(struct ly_ctx *ctx);
/** @} context */
diff --git a/src/dict.h b/src/dict.h
index 7874813..cf897e7 100644
--- a/src/dict.h
+++ b/src/dict.h
@@ -78,7 +78,7 @@
* @return LY_EINVAL in case of invalid input parameters.
* @return LY_EMEM in case of memory allocation failure.
*/
-LY_ERR lydict_insert(const struct ly_ctx *ctx, const char *value, size_t len, const char **str_p);
+LIBYANG_API_DECL LY_ERR lydict_insert(const struct ly_ctx *ctx, const char *value, size_t len, const char **str_p);
/**
* @brief Insert string into dictionary - zerocopy version. If the string is
@@ -97,7 +97,7 @@
* @return LY_EINVAL in case of invalid input parameters.
* @return LY_EMEM in case of memory allocation failure.
*/
-LY_ERR lydict_insert_zc(const struct ly_ctx *ctx, char *value, const char **str_p);
+LIBYANG_API_DECL LY_ERR lydict_insert_zc(const struct ly_ctx *ctx, char *value, const char **str_p);
/**
* @brief Remove specified string from the dictionary. It decrement reference
@@ -111,7 +111,7 @@
* @return LY_ENOTFOUND if the value was not found.
* @return LY_ERR on other errors.
*/
-LY_ERR lydict_remove(const struct ly_ctx *ctx, const char *value);
+LIBYANG_API_DECL LY_ERR lydict_remove(const struct ly_ctx *ctx, const char *value);
/** @} dict */
diff --git a/src/diff.c b/src/diff.c
index cd442fd..889ad51 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -788,13 +788,13 @@
return lyd_diff_siblings_r(first, second, options, nosiblings, diff);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_diff_tree(const struct lyd_node *first, const struct lyd_node *second, uint16_t options, struct lyd_node **diff)
{
return lyd_diff(first, second, options, 1, diff);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_diff_siblings(const struct lyd_node *first, const struct lyd_node *second, uint16_t options, struct lyd_node **diff)
{
return lyd_diff(first, second, options, 0, diff);
@@ -1099,7 +1099,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_diff_apply_module(struct lyd_node **data, const struct lyd_node *diff, const struct lys_module *mod,
lyd_diff_cb diff_cb, void *cb_data)
{
@@ -1124,7 +1124,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_diff_apply_all(struct lyd_node **data, const struct lyd_node *diff)
{
return lyd_diff_apply_module(data, diff, NULL, NULL, NULL);
@@ -1710,7 +1710,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_diff_merge_module(struct lyd_node **diff, const struct lyd_node *src_diff, const struct lys_module *mod,
lyd_diff_cb diff_cb, void *cb_data, uint16_t options)
{
@@ -1733,7 +1733,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_diff_merge_tree(struct lyd_node **diff_first, struct lyd_node *diff_parent, const struct lyd_node *src_sibling,
lyd_diff_cb diff_cb, void *cb_data, uint16_t options)
{
@@ -1749,7 +1749,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_diff_merge_all(struct lyd_node **diff, const struct lyd_node *src_diff, uint16_t options)
{
return lyd_diff_merge_module(diff, src_diff, NULL, NULL, NULL, options);
@@ -1882,7 +1882,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_diff_reverse_all(const struct lyd_node *src_diff, struct lyd_node **diff)
{
LY_ERR ret = LY_SUCCESS;
diff --git a/src/diff.h b/src/diff.h
index 0fa9230..dab1614 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -55,7 +55,7 @@
* @param[in,out] diff Diff to append to.
* @return LY_ERR value.
*/
-LY_ERR lyd_diff_add(const struct lyd_node *node, enum lyd_diff_op op, const char *orig_default, const char *orig_value,
+LIBYANG_API_DECL LY_ERR lyd_diff_add(const struct lyd_node *node, enum lyd_diff_op op, const char *orig_default, const char *orig_value,
const char *key, const char *value, const char *position, const char *orig_key, const char *orig_position,
struct lyd_node **diff);
diff --git a/src/hash_table.c b/src/hash_table.c
index b07c3ad..d0c039a 100644
--- a/src/hash_table.c
+++ b/src/hash_table.c
@@ -156,7 +156,7 @@
return 0;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lydict_remove(const struct ly_ctx *ctx, const char *value)
{
LY_ERR ret = LY_SUCCESS;
@@ -262,7 +262,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lydict_insert(const struct ly_ctx *ctx, const char *value, size_t len, const char **str_p)
{
LY_ERR result;
@@ -285,7 +285,7 @@
return result;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lydict_insert_zc(const struct ly_ctx *ctx, char *value, const char **str_p)
{
LY_ERR result;
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;
diff --git a/src/in.h b/src/in.h
index 109b34f..cde70dd 100644
--- a/src/in.h
+++ b/src/in.h
@@ -93,7 +93,7 @@
* @param[in] in Input handler.
* @return Type of the parser's input.
*/
-LY_IN_TYPE ly_in_type(const struct ly_in *in);
+LIBYANG_API_DECL LY_IN_TYPE ly_in_type(const struct ly_in *in);
/**
* @brief Reset the input medium to read from its beginning, so the following parser function will read from the object's beginning.
@@ -107,7 +107,7 @@
* @return LY_SUCCESS in case of success
* @return LY_ESYS in case of failure
*/
-LY_ERR ly_in_reset(struct ly_in *in);
+LIBYANG_API_DECL LY_ERR ly_in_reset(struct ly_in *in);
/**
* @brief Create input handler using file descriptor.
@@ -117,7 +117,7 @@
* @return LY_SUCCESS in case of success
* @return LY_ERR value in case of failure.
*/
-LY_ERR ly_in_new_fd(int fd, struct ly_in **in);
+LIBYANG_API_DECL LY_ERR ly_in_new_fd(int fd, struct ly_in **in);
/**
* @brief Get or reset file descriptor input handler.
@@ -127,7 +127,7 @@
* @return Previous value of the file descriptor. Note that caller is responsible for closing the returned file descriptor in case of setting new descriptor @p fd.
* @return -1 in case of error when setting up the new file descriptor.
*/
-int ly_in_fd(struct ly_in *in, int fd);
+LIBYANG_API_DECL int ly_in_fd(struct ly_in *in, int fd);
/**
* @brief Create input handler using file stream.
@@ -137,7 +137,7 @@
* @return LY_SUCCESS in case of success
* @return LY_ERR value in case of failure.
*/
-LY_ERR ly_in_new_file(FILE *f, struct ly_in **in);
+LIBYANG_API_DECL LY_ERR ly_in_new_file(FILE *f, struct ly_in **in);
/**
* @brief Get or reset file stream input handler.
@@ -147,7 +147,7 @@
* @return NULL in case of invalid argument or an error when setting up the new input file, original input handler @p in is untouched in this case.
* @return Previous file stream of the handler. Note that caller is responsible for closing the returned stream in case of setting new stream @p f.
*/
-FILE *ly_in_file(struct ly_in *in, FILE *f);
+LIBYANG_API_DECL FILE *ly_in_file(struct ly_in *in, FILE *f);
/**
* @brief Create input handler using memory to read data.
@@ -159,7 +159,7 @@
* @return LY_SUCCESS in case of success
* @return LY_ERR value in case of failure.
*/
-LY_ERR ly_in_new_memory(const char *str, struct ly_in **in);
+LIBYANG_API_DECL LY_ERR ly_in_new_memory(const char *str, struct ly_in **in);
/**
* @brief Get or change memory where the data are read from.
@@ -171,7 +171,7 @@
* @return Previous starting address to read data from. Note that the caller is responsible to free
* the data in case of changing string pointer @p str.
*/
-const char *ly_in_memory(struct ly_in *in, const char *str);
+LIBYANG_API_DECL const char *ly_in_memory(struct ly_in *in, const char *str);
/**
* @brief Create input handler file of the given filename.
@@ -183,7 +183,7 @@
* @return LY_SUCCESS in case of success
* @return LY_ERR value in case of failure.
*/
-LY_ERR ly_in_new_filepath(const char *filepath, size_t len, struct ly_in **in);
+LIBYANG_API_DECL LY_ERR ly_in_new_filepath(const char *filepath, size_t len, struct ly_in **in);
/**
* @brief Get or change the filepath of the file where the parser reads the data.
@@ -199,7 +199,7 @@
* @return Previous filepath string in case the @p filepath argument is NULL.
* @return NULL if changing filepath succeedes and ((void *)-1) otherwise.
*/
-const char *ly_in_filepath(struct ly_in *in, const char *filepath, size_t len);
+LIBYANG_API_DECL const char *ly_in_filepath(struct ly_in *in, const char *filepath, size_t len);
/**
* @brief Get the number of parsed bytes by the last function.
@@ -207,7 +207,7 @@
* @param[in] in In structure used.
* @return Number of parsed bytes.
*/
-size_t ly_in_parsed(const struct ly_in *in);
+LIBYANG_API_DECL size_t ly_in_parsed(const struct ly_in *in);
/**
* @brief Free the input handler.
@@ -215,7 +215,7 @@
* @param[in] destroy Flag to free the input data buffer (for LY_IN_MEMORY) or to
* close stream/file descriptor (for LY_IN_FD and LY_IN_FILE)
*/
-void ly_in_free(struct ly_in *in, ly_bool destroy);
+LIBYANG_API_DECL void ly_in_free(struct ly_in *in, ly_bool destroy);
#ifdef __cplusplus
}
diff --git a/src/log.c b/src/log.c
index c023f65..d943017 100644
--- a/src/log.c
+++ b/src/log.c
@@ -46,7 +46,7 @@
/* how many bytes add when enlarging buffers */
#define LY_BUF_STEP 128
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_errcode(const struct ly_ctx *ctx)
{
struct ly_err_item *i;
@@ -59,7 +59,7 @@
return LY_SUCCESS;
}
-API LY_VECODE
+LIBYANG_API_DEF LY_VECODE
ly_vecode(const struct ly_ctx *ctx)
{
struct ly_err_item *i;
@@ -72,7 +72,7 @@
return LYVE_SUCCESS;
}
-API const char *
+LIBYANG_API_DEF const char *
ly_errmsg(const struct ly_ctx *ctx)
{
struct ly_err_item *i;
@@ -87,7 +87,7 @@
return NULL;
}
-API const char *
+LIBYANG_API_DEF const char *
ly_errpath(const struct ly_ctx *ctx)
{
struct ly_err_item *i;
@@ -102,7 +102,7 @@
return NULL;
}
-API const char *
+LIBYANG_API_DEF const char *
ly_errapptag(const struct ly_ctx *ctx)
{
struct ly_err_item *i;
@@ -117,7 +117,7 @@
return NULL;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_err_new(struct ly_err_item **err, LY_ERR ecode, LY_VECODE vecode, char *path, char *apptag, const char *err_format, ...)
{
char *msg = NULL;
@@ -165,7 +165,7 @@
return e->no;
}
-API struct ly_err_item *
+LIBYANG_API_DEF struct ly_err_item *
ly_err_first(const struct ly_ctx *ctx)
{
LY_CHECK_ARG_RET(NULL, ctx, NULL);
@@ -173,7 +173,7 @@
return pthread_getspecific(ctx->errlist_key);
}
-API struct ly_err_item *
+LIBYANG_API_DEF struct ly_err_item *
ly_err_last(const struct ly_ctx *ctx)
{
const struct ly_err_item *e;
@@ -184,7 +184,7 @@
return e ? e->prev : NULL;
}
-API void
+LIBYANG_API_DEF void
ly_err_free(void *ptr)
{
struct ly_err_item *i, *next;
@@ -199,7 +199,7 @@
}
}
-API void
+LIBYANG_API_DEF void
ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem)
{
struct ly_err_item *i, *first;
@@ -223,7 +223,7 @@
}
}
-API LY_LOG_LEVEL
+LIBYANG_API_DEF LY_LOG_LEVEL
ly_log_level(LY_LOG_LEVEL level)
{
LY_LOG_LEVEL prev = ATOMIC_LOAD_RELAXED(ly_ll);
@@ -232,7 +232,7 @@
return prev;
}
-API uint32_t
+LIBYANG_API_DEF uint32_t
ly_log_options(uint32_t opts)
{
uint32_t prev = ATOMIC_LOAD_RELAXED(ly_log_opts);
@@ -241,7 +241,7 @@
return prev;
}
-API uint32_t
+LIBYANG_API_DEF uint32_t
ly_log_dbg_groups(uint32_t dbg_groups)
{
#ifndef NDEBUG
@@ -255,14 +255,14 @@
#endif
}
-API void
+LIBYANG_API_DEF void
ly_set_log_clb(ly_log_clb clb, ly_bool path)
{
log_clb = clb;
ATOMIC_STORE_RELAXED(path_flag, path);
}
-API ly_log_clb
+LIBYANG_API_DEF ly_log_clb
ly_get_log_clb(void)
{
return log_clb;
@@ -604,7 +604,7 @@
va_end(ap);
}
-API void
+LIBYANG_API_DEF void
lyplg_ext_log(const struct lysc_ext_instance *ext, LY_LOG_LEVEL level, LY_ERR err_no, const char *path, const char *format, ...)
{
va_list ap;
@@ -650,7 +650,7 @@
va_end(ap);
}
-API void
+LIBYANG_API_DEF void
ly_err_print(const struct ly_ctx *ctx, struct ly_err_item *eitem)
{
/* String ::ly_err_item.msg cannot be used directly because it may contain the % character */
diff --git a/src/log.h b/src/log.h
index 7c60cae..d67eb96 100644
--- a/src/log.h
+++ b/src/log.h
@@ -17,6 +17,8 @@
#include <stdint.h>
+#include "config.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -99,7 +101,7 @@
* @param[in] level Verbosity level.
* @return Previous verbosity level.
*/
-LY_LOG_LEVEL ly_log_level(LY_LOG_LEVEL level);
+LIBYANG_API_DECL LY_LOG_LEVEL ly_log_level(LY_LOG_LEVEL level);
/**
* @ingroup logger
@@ -130,7 +132,7 @@
* @param[in] opts Bitfield of @ref logopts.
* @return Previous logger options.
*/
-uint32_t ly_log_options(uint32_t opts);
+LIBYANG_API_DECL uint32_t ly_log_options(uint32_t opts);
#ifndef NDEBUG
@@ -188,13 +190,13 @@
* presence) or it can be NULL, so consider it as an optional parameter. If the flag is 0, libyang will
* not bother with resolving the path.
*/
-void ly_set_log_clb(ly_log_clb clb, ly_bool path);
+LIBYANG_API_DECL void ly_set_log_clb(ly_log_clb clb, ly_bool path);
/**
* @brief Get logger callback.
* @return Logger callback (can be NULL).
*/
-ly_log_clb ly_get_log_clb(void);
+LIBYANG_API_DECL ly_log_clb ly_get_log_clb(void);
/** @} log */
@@ -304,7 +306,7 @@
* @param[in] ctx Relative context.
* @return Validation error code.
*/
-LY_VECODE ly_vecode(const struct ly_ctx *ctx);
+LIBYANG_API_DECL LY_VECODE ly_vecode(const struct ly_ctx *ctx);
/**
* @brief Get the last (thread, context-specific) error code.
@@ -312,7 +314,7 @@
* @param[in] ctx Relative context.
* @return LY_ERR value of the last error code.
*/
-LY_ERR ly_errcode(const struct ly_ctx *ctx);
+LIBYANG_API_DECL LY_ERR ly_errcode(const struct ly_ctx *ctx);
/**
* @brief Get the last (thread, context-specific) error message. If the coresponding module defined
@@ -324,7 +326,7 @@
* @param[in] ctx Relative context.
* @return Text of the last error message, empty string if there is no error.
*/
-const char *ly_errmsg(const struct ly_ctx *ctx);
+LIBYANG_API_DECL const char *ly_errmsg(const struct ly_ctx *ctx);
/**
* @brief Get the last (thread, context-specific) path of the element where was an error.
@@ -339,7 +341,7 @@
* @param[in] ctx Relative context.
* @return Path of the error element, empty string if error path does not apply to the last error.
*/
-const char *ly_errpath(const struct ly_ctx *ctx);
+LIBYANG_API_DECL const char *ly_errpath(const struct ly_ctx *ctx);
/**
* @brief Get the last (thread, context-specific) error-app-tag if there was a specific one defined
@@ -351,7 +353,7 @@
* @param[in] ctx Relative context.
* @return Error-app-tag of the last error, empty string if the error-app-tag does not apply to the last error.
*/
-const char *ly_errapptag(const struct ly_ctx *ctx);
+LIBYANG_API_DECL const char *ly_errapptag(const struct ly_ctx *ctx);
/**
* @brief Get the first (thread, context-specific) generated error structure.
@@ -359,7 +361,7 @@
* @param[in] ctx Relative context.
* @return The first error structure (can be NULL), do not modify!
*/
-struct ly_err_item *ly_err_first(const struct ly_ctx *ctx);
+LIBYANG_API_DECL struct ly_err_item *ly_err_first(const struct ly_ctx *ctx);
/**
* @brief Get the latest (thread, context-specific) generated error structure.
@@ -367,7 +369,7 @@
* @param[in] ctx Relative context.
* @return The last error structure (can be NULL), do not modify!
*/
-struct ly_err_item *ly_err_last(const struct ly_ctx *ctx);
+LIBYANG_API_DECL struct ly_err_item *ly_err_last(const struct ly_ctx *ctx);
/**
* @brief Print the error structure as if just generated.
@@ -375,7 +377,7 @@
* @param[in] ctx Optional context to store the message in.
* @param[in] eitem Error item structure to print.
*/
-void ly_err_print(const struct ly_ctx *ctx, struct ly_err_item *eitem);
+LIBYANG_API_DECL void ly_err_print(const struct ly_ctx *ctx, struct ly_err_item *eitem);
/**
* @brief Free error structures from a context.
@@ -385,7 +387,7 @@
* @param[in] ctx Relative context.
* @param[in] eitem Oldest error structure to remove, optional.
*/
-void ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem);
+LIBYANG_API_DECL void ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem);
/** @} errors */
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;
diff --git a/src/out.h b/src/out.h
index 7ecf347..e2fd0b1 100644
--- a/src/out.h
+++ b/src/out.h
@@ -104,7 +104,7 @@
* @param[in] out Printer handler.
* @return Type of the printer's output.
*/
-LY_OUT_TYPE ly_out_type(const struct ly_out *out);
+LIBYANG_API_DECL LY_OUT_TYPE ly_out_type(const struct ly_out *out);
/**
* @brief Reset the output medium to write from its beginning, so the following printer function will rewrite the current data
@@ -119,7 +119,7 @@
* @return LY_SUCCESS in case of success
* @return LY_ESYS in case of failure
*/
-LY_ERR ly_out_reset(struct ly_out *out);
+LIBYANG_API_DECL LY_ERR ly_out_reset(struct ly_out *out);
/**
* @brief Generic write callback for data printed by libyang.
@@ -141,7 +141,7 @@
* @return LY_SUCCESS in case of success
* @return LY_EMEM in case allocating the @p out handler fails.
*/
-LY_ERR ly_out_new_clb(ly_write_clb writeclb, void *user_data, struct ly_out **out);
+LIBYANG_API_DECL LY_ERR ly_out_new_clb(ly_write_clb writeclb, void *user_data, struct ly_out **out);
/**
* @brief Get or reset callback function associated with a callback printer handler.
@@ -151,7 +151,7 @@
* printer callback is returned.
* @return Previous printer callback.
*/
-ly_write_clb ly_out_clb(struct ly_out *out, ly_write_clb writeclb);
+LIBYANG_API_DECL ly_write_clb ly_out_clb(struct ly_out *out, ly_write_clb writeclb);
/**
* @brief Get or reset callback function's argument associated with a callback printer handler.
@@ -161,7 +161,7 @@
* If NULL, only the current file descriptor value is returned.
* @return The previous callback argument.
*/
-void *ly_out_clb_arg(struct ly_out *out, void *arg);
+LIBYANG_API_DECL void *ly_out_clb_arg(struct ly_out *out, void *arg);
/**
* @brief Create printer handler using file descriptor.
@@ -171,7 +171,7 @@
* @return LY_SUCCESS in case of success
* @return LY_ERR value in case of failure.
*/
-LY_ERR ly_out_new_fd(int fd, struct ly_out **out);
+LIBYANG_API_DECL LY_ERR ly_out_new_fd(int fd, struct ly_out **out);
/**
* @brief Get or reset file descriptor printer handler.
@@ -181,7 +181,7 @@
* @return Previous value of the file descriptor. Note that caller is responsible for closing the returned file descriptor in case of setting new descriptor @p fd.
* @return -1 in case of error when setting up the new file descriptor.
*/
-int ly_out_fd(struct ly_out *out, int fd);
+LIBYANG_API_DECL int ly_out_fd(struct ly_out *out, int fd);
/**
* @brief Create printer handler using file stream.
@@ -191,7 +191,7 @@
* @return LY_SUCCESS in case of success
* @return LY_ERR value in case of failure.
*/
-LY_ERR ly_out_new_file(FILE *f, struct ly_out **out);
+LIBYANG_API_DECL LY_ERR ly_out_new_file(FILE *f, struct ly_out **out);
/**
* @brief Get or reset file stream printer handler.
@@ -200,7 +200,7 @@
* @param[in] f Optional new file stream for the handler. If NULL, only the current file stream is returned.
* @return Previous file stream of the handler. Note that caller is responsible for closing the returned stream in case of setting new stream @p f.
*/
-FILE *ly_out_file(struct ly_out *out, FILE *f);
+LIBYANG_API_DECL FILE *ly_out_file(struct ly_out *out, FILE *f);
/**
* @brief Create printer handler using memory to dump data.
@@ -213,7 +213,7 @@
* @return LY_SUCCESS in case of success
* @return LY_ERR value in case of failure.
*/
-LY_ERR ly_out_new_memory(char **strp, size_t size, struct ly_out **out);
+LIBYANG_API_DECL LY_ERR ly_out_new_memory(char **strp, size_t size, struct ly_out **out);
/**
* @brief Get or change memory where the data are dumped.
@@ -225,7 +225,7 @@
* parameter is ignored.
* @return Previous dumped data. Note that the caller is responsible to free the data in case of changing string pointer @p strp.
*/
-char *ly_out_memory(struct ly_out *out, char **strp, size_t size);
+LIBYANG_API_DECL char *ly_out_memory(struct ly_out *out, char **strp, size_t size);
/**
* @brief Create printer handler file of the given filename.
@@ -235,7 +235,7 @@
* @return NULL in case of error.
* @return Created printer handler supposed to be passed to different ly*_print_*() functions.
*/
-LY_ERR ly_out_new_filepath(const char *filepath, struct ly_out **out);
+LIBYANG_API_DECL LY_ERR ly_out_new_filepath(const char *filepath, struct ly_out **out);
/**
* @brief Get or change the filepath of the file where the printer prints the data.
@@ -249,7 +249,7 @@
* @return Previous filepath string in case the @p filepath argument is NULL.
* @return NULL if changing filepath succeeds and ((void *)-1) otherwise.
*/
-const char *ly_out_filepath(struct ly_out *out, const char *filepath);
+LIBYANG_API_DECL const char *ly_out_filepath(struct ly_out *out, const char *filepath);
/**
* @brief Generic printer of the given format string into the specified output.
@@ -260,13 +260,13 @@
* @param[in] format Format string to be printed.
* @return LY_ERR value, get number of the printed bytes using ::ly_out_printed.
*/
-LY_ERR ly_print(struct ly_out *out, const char *format, ...);
+LIBYANG_API_DECL LY_ERR ly_print(struct ly_out *out, const char *format, ...);
/**
* @brief Flush the output from any internal buffers and clean any auxiliary data.
* @param[in] out Output specification.
*/
-void ly_print_flush(struct ly_out *out);
+LIBYANG_API_DECL void ly_print_flush(struct ly_out *out);
/**
* @brief Generic printer of the given string buffer into the specified output.
@@ -278,7 +278,7 @@
* @param[in] len Length of the data to print in the @p buf.
* @return LY_ERR value, get number of the printed bytes using ::ly_out_printed.
*/
-LY_ERR ly_write(struct ly_out *out, const char *buf, size_t len);
+LIBYANG_API_DECL LY_ERR ly_write(struct ly_out *out, const char *buf, size_t len);
/**
* @brief Get the number of printed bytes by the last function.
@@ -286,7 +286,7 @@
* @param[in] out Out structure used.
* @return Number of printed bytes.
*/
-size_t ly_out_printed(const struct ly_out *out);
+LIBYANG_API_DECL size_t ly_out_printed(const struct ly_out *out);
/**
* @brief Free the printer handler.
@@ -295,7 +295,7 @@
* @param[in] destroy Flag to free allocated buffer (for LY_OUT_MEMORY) or to
* close stream/file descriptor (for LY_OUT_FD, LY_OUT_FDSTREAM and LY_OUT_FILE)
*/
-void ly_out_free(struct ly_out *out, void (*clb_arg_destructor)(void *arg), ly_bool destroy);
+LIBYANG_API_DECL void ly_out_free(struct ly_out *out, void (*clb_arg_destructor)(void *arg), ly_bool destroy);
#ifdef __cplusplus
}
diff --git a/src/parser_data.h b/src/parser_data.h
index a65e1c8..53f03dc 100644
--- a/src/parser_data.h
+++ b/src/parser_data.h
@@ -206,7 +206,7 @@
* @return LY_SUCCESS in case of successful parsing (and validation).
* @return LY_ERR value in case of error. Additional error information can be obtained from the context using ly_err* functions.
*/
-LY_ERR lyd_parse_data(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
+LIBYANG_API_DECL LY_ERR lyd_parse_data(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
/**
@@ -223,7 +223,7 @@
* @return LY_SUCCESS in case of successful parsing (and validation).
* @return LY_ERR value in case of error. Additional error information can be obtained from the context using ly_err* functions.
*/
-LY_ERR lyd_parse_data_mem(const struct ly_ctx *ctx, const char *data, LYD_FORMAT format, uint32_t parse_options,
+LIBYANG_API_DECL LY_ERR lyd_parse_data_mem(const struct ly_ctx *ctx, const char *data, LYD_FORMAT format, uint32_t parse_options,
uint32_t validate_options, struct lyd_node **tree);
/**
@@ -241,7 +241,7 @@
* @return LY_SUCCESS in case of successful parsing (and validation).
* @return LY_ERR value in case of error. Additional error information can be obtained from the context using ly_err* functions.
*/
-LY_ERR lyd_parse_data_fd(const struct ly_ctx *ctx, int fd, LYD_FORMAT format, uint32_t parse_options,
+LIBYANG_API_DECL LY_ERR lyd_parse_data_fd(const struct ly_ctx *ctx, int fd, LYD_FORMAT format, uint32_t parse_options,
uint32_t validate_options, struct lyd_node **tree);
/**
@@ -258,7 +258,7 @@
* @return LY_SUCCESS in case of successful parsing (and validation).
* @return LY_ERR value in case of error. Additional error information can be obtained from the context using ly_err* functions.
*/
-LY_ERR lyd_parse_data_path(const struct ly_ctx *ctx, const char *path, LYD_FORMAT format, uint32_t parse_options,
+LIBYANG_API_DECL LY_ERR lyd_parse_data_path(const struct ly_ctx *ctx, const char *path, LYD_FORMAT format, uint32_t parse_options,
uint32_t validate_options, struct lyd_node **tree);
/**
@@ -280,7 +280,7 @@
* @return LY_SUCCESS in case of successful parsing (and validation).
* @return LY_ERR value in case of error. Additional error information can be obtained from the context using ly_err* functions.
*/
-LY_ERR lyd_parse_ext_data(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
+LIBYANG_API_DECL LY_ERR lyd_parse_ext_data(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
/**
@@ -351,7 +351,7 @@
* @return LY_ERR value.
* @return LY_ENOT if @p data_type is a NETCONF message and the root XML element is not the expected one.
*/
-LY_ERR lyd_parse_op(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
+LIBYANG_API_DECL LY_ERR lyd_parse_op(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op);
/**
@@ -394,7 +394,7 @@
* @return LY_ERR value.
* @return LY_ENOT if @p data_type is a NETCONF message and the root XML element is not the expected one.
*/
-LY_ERR lyd_parse_ext_op(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
+LIBYANG_API_DECL LY_ERR lyd_parse_ext_op(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op);
/**
@@ -410,7 +410,7 @@
* @return LY_SUCCESS on success.
* @return LY_ERR error on error.
*/
-LY_ERR lyd_validate_all(struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t val_opts, struct lyd_node **diff);
+LIBYANG_API_DECL LY_ERR lyd_validate_all(struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t val_opts, struct lyd_node **diff);
/**
* @brief Fully validate a data tree of a module.
@@ -425,7 +425,7 @@
* @return LY_SUCCESS on success.
* @return LY_ERR error on error.
*/
-LY_ERR lyd_validate_module(struct lyd_node **tree, const struct lys_module *module, uint32_t val_opts, struct lyd_node **diff);
+LIBYANG_API_DECL LY_ERR lyd_validate_module(struct lyd_node **tree, const struct lys_module *module, uint32_t val_opts, struct lyd_node **diff);
/**
* @brief Validate an RPC/action request, reply, or notification.
@@ -438,7 +438,7 @@
* @return LY_SUCCESS on success.
* @return LY_ERR error on error.
*/
-LY_ERR lyd_validate_op(struct lyd_node *op_tree, const struct lyd_node *dep_tree, enum lyd_type data_type,
+LIBYANG_API_DECL LY_ERR lyd_validate_op(struct lyd_node *op_tree, const struct lyd_node *dep_tree, enum lyd_type data_type,
struct lyd_node **diff);
/** @} datatree */
diff --git a/src/parser_lyb.c b/src/parser_lyb.c
index 596e48c..3352ed9 100644
--- a/src/parser_lyb.c
+++ b/src/parser_lyb.c
@@ -1647,7 +1647,7 @@
return _lyd_parse_lyb(ctx, ext, parent, first_p, in, parse_opts, val_opts, int_opts, parsed, lydctx_p);
}
-API int
+LIBYANG_API_DEF int
lyd_lyb_data_length(const char *data)
{
LY_ERR ret = LY_SUCCESS;
diff --git a/src/parser_schema.h b/src/parser_schema.h
index 0c392d3..f8df16d 100644
--- a/src/parser_schema.h
+++ b/src/parser_schema.h
@@ -104,7 +104,7 @@
* @param[out] module Optional parsed module.
* @return LY_ERR value.
*/
-LY_ERR lys_parse(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, const char **features,
+LIBYANG_API_DECL LY_ERR lys_parse(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, const char **features,
struct lys_module **module);
/**
@@ -119,7 +119,7 @@
* @param[out] module Optional parsed module.
* @return LY_ERR value.
*/
-LY_ERR lys_parse_mem(struct ly_ctx *ctx, const char *data, LYS_INFORMAT format, struct lys_module **module);
+LIBYANG_API_DECL LY_ERR lys_parse_mem(struct ly_ctx *ctx, const char *data, LYS_INFORMAT format, struct lys_module **module);
/**
* @brief Read a schema from file descriptor into the specified context.
@@ -136,7 +136,7 @@
* @param[out] module Optional parsed module.
* @return LY_ERR value.
*/
-LY_ERR lys_parse_fd(struct ly_ctx *ctx, int fd, LYS_INFORMAT format, struct lys_module **module);
+LIBYANG_API_DECL LY_ERR lys_parse_fd(struct ly_ctx *ctx, int fd, LYS_INFORMAT format, struct lys_module **module);
/**
* @brief Load a schema into the specified context from a file.
@@ -150,7 +150,7 @@
* @param[out] module Optional parsed module.
* @return LY_ERR value.
*/
-LY_ERR lys_parse_path(struct ly_ctx *ctx, const char *path, LYS_INFORMAT format, struct lys_module **module);
+LIBYANG_API_DECL LY_ERR lys_parse_path(struct ly_ctx *ctx, const char *path, LYS_INFORMAT format, struct lys_module **module);
/**
* @brief Search for the schema file in the specified searchpaths.
@@ -167,7 +167,7 @@
* file suffix.
* @return LY_ERR value (LY_SUCCESS is returned even if the file is not found, then the *localfile is NULL).
*/
-LY_ERR lys_search_localfile(const char * const *searchpaths, ly_bool cwd, const char *name, const char *revision,
+LIBYANG_API_DECL LY_ERR lys_search_localfile(const char * const *searchpaths, ly_bool cwd, const char *name, const char *revision,
char **localfile, LYS_INFORMAT *format);
/** @} schematree */
diff --git a/src/plugins.c b/src/plugins.c
index db3e565..43d70c6 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -486,7 +486,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_add(const char *pathname)
{
#ifdef STATIC
diff --git a/src/plugins.h b/src/plugins.h
index 6263c7d..f868879 100644
--- a/src/plugins.h
+++ b/src/plugins.h
@@ -83,7 +83,7 @@
* @return LY_EINVAL when pathname is NULL or the plugin contains invalid content for this libyang version.
* @return LY_ESYS when the plugin file cannot be loaded.
*/
-LY_ERR lyplg_add(const char *pathname);
+LIBYANG_API_DECL LY_ERR lyplg_add(const char *pathname);
/** @} plugins */
diff --git a/src/plugins_exts.c b/src/plugins_exts.c
index 18c9250..90fc70a 100644
--- a/src/plugins_exts.c
+++ b/src/plugins_exts.c
@@ -27,37 +27,37 @@
#include "printer_internal.h"
#include "schema_compile.h"
-API struct ly_ctx *
+LIBYANG_API_DEF struct ly_ctx *
lysc_ctx_get_ctx(const struct lysc_ctx *ctx)
{
return ctx->ctx;
}
-API uint32_t *
+LIBYANG_API_DEF uint32_t *
lysc_ctx_get_options(const struct lysc_ctx *ctx)
{
return &((struct lysc_ctx *)ctx)->compile_opts;
}
-API const char *
+LIBYANG_API_DEF const char *
lysc_ctx_get_path(const struct lysc_ctx *ctx)
{
return ctx->path;
}
-API struct ly_out **
+LIBYANG_API_DEF struct ly_out **
lys_ypr_ctx_get_out(const struct lyspr_ctx *ctx)
{
return &((struct lyspr_ctx *)ctx)->out;
}
-API uint32_t *
+LIBYANG_API_DEF uint32_t *
lys_ypr_ctx_get_options(const struct lyspr_ctx *ctx)
{
return &((struct lyspr_ctx *)ctx)->options;
}
-API uint16_t *
+LIBYANG_API_DEF uint16_t *
lys_ypr_ctx_get_level(const struct lyspr_ctx *ctx)
{
return &((struct lyspr_ctx *)ctx)->level;
diff --git a/src/plugins_exts.h b/src/plugins_exts.h
index 97e0893..2a4594f 100644
--- a/src/plugins_exts.h
+++ b/src/plugins_exts.h
@@ -117,7 +117,7 @@
* @param[in] substmts The sized array of extension instance's substatements. The whole array is freed except the storage
* places which are expected to be covered by the extension plugin.
*/
-void lyplg_ext_instance_substatements_free(struct ly_ctx *ctx, struct lysc_ext_substmt *substmts);
+LIBYANG_API_DECL void lyplg_ext_instance_substatements_free(struct ly_ctx *ctx, struct lysc_ext_substmt *substmts);
/**
* @brief Callback to compile extension from the lysp_ext_instance to the lysc_ext_instance. The later structure is generally prepared
@@ -204,7 +204,7 @@
* @param[in] path Path relevant to the message.
* @param[in] format Format string to print.
*/
-void lyplg_ext_log(const struct lysc_ext_instance *ext, LY_LOG_LEVEL level, LY_ERR err_no, const char *path,
+LIBYANG_API_DECL void lyplg_ext_log(const struct lysc_ext_instance *ext, LY_LOG_LEVEL level, LY_ERR err_no, const char *path,
const char *format, ...);
/** @} pluginsExtensions */
diff --git a/src/plugins_exts_compile.h b/src/plugins_exts_compile.h
index 3a0d148..1e14a20 100644
--- a/src/plugins_exts_compile.h
+++ b/src/plugins_exts_compile.h
@@ -74,21 +74,21 @@
* @param[in] ctx YANG schema compilation context.
* @return libyang context connected with the compilation context.
*/
-struct ly_ctx *lysc_ctx_get_ctx(const struct lysc_ctx *ctx);
+LIBYANG_API_DECL struct ly_ctx *lysc_ctx_get_ctx(const struct lysc_ctx *ctx);
/**
* @brief YANG schema compilation context getter for compilation options.
* @param[in] ctx YANG schema compilation context.
* @return pointer to the compilation options to allow modifying them with @ref scflags values.
*/
-uint32_t *lysc_ctx_get_options(const struct lysc_ctx *ctx);
+LIBYANG_API_DECL uint32_t *lysc_ctx_get_options(const struct lysc_ctx *ctx);
/**
* @brief YANG schema compilation context getter for path being currently processed.
* @param[in] ctx YANG schema compilation context.
* @return path identifying the place in schema being currently processed by the schema compiler.
*/
-const char *lysc_ctx_get_path(const struct lysc_ctx *ctx);
+LIBYANG_API_DECL const char *lysc_ctx_get_path(const struct lysc_ctx *ctx);
/**
* @brief Compile substatements of an extension instance.
@@ -105,7 +105,7 @@
* @return LY_EVALID if compilation of the substatements fails.
* @return LY_ENOT if the extension is disabled (by if-feature) and should be ignored.
*/
-LY_ERR lys_compile_extension_instance(struct lysc_ctx *ctx, const struct lysp_ext_instance *ext_p, struct lysc_ext_instance *ext);
+LIBYANG_API_DECL LY_ERR lys_compile_extension_instance(struct lysc_ctx *ctx, const struct lysp_ext_instance *ext_p, struct lysc_ext_instance *ext);
/**
* @brief Update path in the compile context, which is used for logging where the compilation failed.
@@ -115,7 +115,7 @@
* @param[in] name Name of the node to update path with. If NULL, the last segment is removed. If the format is `{keyword}`, the following
* call updates the segment to the form `{keyword='name'}` (to remove this compound segment, 2 calls with NULL @p name must be used).
*/
-void lysc_update_path(struct lysc_ctx *ctx, struct lys_module *parent_module, const char *name);
+LIBYANG_API_DECL void lysc_update_path(struct lysc_ctx *ctx, struct lys_module *parent_module, const char *name);
/**
* @brief Duplicate the compiled extension (definition) structure.
@@ -123,7 +123,7 @@
* @param[in] orig The extension structure to duplicate.
* @return The duplicated structure to use.
*/
-struct lysc_ext *lysc_ext_dup(struct lysc_ext *orig);
+LIBYANG_API_DECL struct lysc_ext *lysc_ext_dup(struct lysc_ext *orig);
/** @} extensions */
diff --git a/src/plugins_exts_print.h b/src/plugins_exts_print.h
index 6a95419..aed3b36 100644
--- a/src/plugins_exts_print.h
+++ b/src/plugins_exts_print.h
@@ -17,6 +17,8 @@
#include <stdint.h>
+#include "config.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -47,21 +49,21 @@
* @return Output handler where the data are being printed. Note that the address of the handler pointer in the context is
* returned to allow to modify the handler.
*/
-struct ly_out **lys_ypr_ctx_get_out(const struct lyspr_ctx *ctx);
+LIBYANG_API_DECL struct ly_out **lys_ypr_ctx_get_out(const struct lyspr_ctx *ctx);
/**
* @brief YANG printer context getter for printer options.
* @param[in] ctx YANG printer context.
* @return pointer to the printer options to allow modifying them with @ref schemaprinterflags values.
*/
-uint32_t *lys_ypr_ctx_get_options(const struct lyspr_ctx *ctx);
+LIBYANG_API_DECL uint32_t *lys_ypr_ctx_get_options(const struct lyspr_ctx *ctx);
/**
* @brief YANG printer context getter for printer indentation level.
* @param[in] ctx YANG printer context.
* @return pointer to the printer's indentation level to allow modifying its value.
*/
-uint16_t *lys_ypr_ctx_get_level(const struct lyspr_ctx *ctx);
+LIBYANG_API_DECL uint16_t *lys_ypr_ctx_get_level(const struct lyspr_ctx *ctx);
/**
* @brief Print substatements of an extension instance
@@ -73,7 +75,7 @@
* @param[in, out] flag Flag to be shared with the caller regarding the opening brackets - 0 if the '{' not yet printed,
* 1 otherwise.
*/
-void lysc_print_extension_instance(struct lyspr_ctx *ctx, const struct lysc_ext_instance *ext, ly_bool *flag);
+LIBYANG_API_DECL void lysc_print_extension_instance(struct lyspr_ctx *ctx, const struct lysc_ext_instance *ext, ly_bool *flag);
/** @} pluginsExtensionsPrint */
diff --git a/src/plugins_types.c b/src/plugins_types.c
index e8203d6..88625c1 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -146,7 +146,7 @@
return mod;
}
-API const struct lys_module *
+LIBYANG_API_DEF const struct lys_module *
lyplg_type_identity_module(const struct ly_ctx *ctx, const struct lysc_node *ctx_node,
const char *prefix, size_t prefix_len, LY_VALUE_FORMAT format, const void *prefix_data)
{
@@ -263,13 +263,13 @@
return prefix;
}
-API const char *
+LIBYANG_API_DEF const char *
lyplg_type_get_prefix(const struct lys_module *mod, LY_VALUE_FORMAT format, void *prefix_data)
{
return ly_get_prefix(mod, format, prefix_data);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_compare_simple(const struct lyd_value *val1, const struct lyd_value *val2)
{
if (val1->realtype != val2->realtype) {
@@ -283,7 +283,7 @@
return LY_ENOT;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_simple(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT UNUSED(format),
void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
{
@@ -296,7 +296,7 @@
return value->_canonical;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_dup_simple(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
{
memset(dup, 0, sizeof *dup);
@@ -306,14 +306,14 @@
return LY_SUCCESS;
}
-API void
+LIBYANG_API_DEF void
lyplg_type_free_simple(const struct ly_ctx *ctx, struct lyd_value *value)
{
lydict_remove(ctx, value->_canonical);
value->_canonical = NULL;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_parse_int(const char *datatype, int base, int64_t min, int64_t max, const char *value, size_t value_len,
int64_t *ret, struct ly_err_item **err)
{
@@ -338,7 +338,7 @@
}
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_parse_uint(const char *datatype, int base, uint64_t max, const char *value, size_t value_len, uint64_t *ret,
struct ly_err_item **err)
{
@@ -366,7 +366,7 @@
}
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_parse_dec64(uint8_t fraction_digits, const char *value, size_t value_len, int64_t *ret, struct ly_err_item **err)
{
LY_ERR ret_val;
@@ -461,7 +461,7 @@
return ret_val;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_validate_patterns(struct lysc_pattern **patterns, const char *str, size_t str_len, struct ly_err_item **err)
{
int rc, match_opts;
@@ -508,7 +508,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_validate_range(LY_DATA_TYPE basetype, struct lysc_range *range, int64_t value, const char *strval,
size_t strval_len, struct ly_err_item **err)
{
@@ -569,7 +569,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_prefix_data_new(const struct ly_ctx *ctx, const void *value, size_t value_len, LY_VALUE_FORMAT format,
const void *prefix_data, LY_VALUE_FORMAT *format_p, void **prefix_data_p)
{
@@ -579,7 +579,7 @@
return ly_store_prefix_data(ctx, value, value_len, format, prefix_data, format_p, (void **)prefix_data_p);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_prefix_data_dup(const struct ly_ctx *ctx, LY_VALUE_FORMAT format, const void *orig, void **dup)
{
LY_CHECK_ARG_RET(NULL, dup, LY_EINVAL);
@@ -592,7 +592,7 @@
return ly_dup_prefix_data(ctx, format, orig, (void **)dup);
}
-API void
+LIBYANG_API_DEF void
lyplg_type_prefix_data_free(LY_VALUE_FORMAT format, void *prefix_data)
{
ly_free_prefix_data(format, prefix_data);
@@ -615,7 +615,7 @@
}
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_check_hints(uint32_t hints, const char *value, size_t value_len, LY_DATA_TYPE type, int *base,
struct ly_err_item **err)
{
@@ -684,7 +684,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_check_status(const struct lysc_node *ctx_node, uint16_t val_flags, LY_VALUE_FORMAT format, void *prefix_data,
const char *val_name, struct ly_err_item **err)
{
@@ -719,7 +719,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_lypath_check_status(const struct lysc_node *ctx_node, const struct ly_path *path, LY_VALUE_FORMAT format,
void *prefix_data, struct ly_err_item **err)
{
@@ -759,7 +759,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_lypath_new(const struct ly_ctx *ctx, const char *value, size_t value_len, uint32_t options,
LY_VALUE_FORMAT format, void *prefix_data, const struct lysc_node *ctx_node, struct lys_glob_unres *unres,
struct ly_path **path, struct ly_err_item **err)
@@ -818,13 +818,13 @@
return ret;
}
-API void
+LIBYANG_API_DEF void
lyplg_type_lypath_free(const struct ly_ctx *ctx, struct ly_path *path)
{
ly_path_free(ctx, path);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_make_implemented(struct lys_module *mod, const char **features, struct lys_glob_unres *unres)
{
if (mod->implemented) {
@@ -837,7 +837,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_identity_isderived(const struct lysc_ident *base, const struct lysc_ident *der)
{
LY_ARRAY_COUNT_TYPE u;
@@ -853,7 +853,7 @@
return LY_ENOTFOUND;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_resolve_leafref(const struct lysc_type_leafref *lref, const struct lyd_node *node, struct lyd_value *value,
const struct lyd_node *tree, struct lyd_node **target, char **errmsg)
{
diff --git a/src/plugins_types.h b/src/plugins_types.h
index 4e13ce1..13cee84 100644
--- a/src/plugins_types.h
+++ b/src/plugins_types.h
@@ -223,7 +223,7 @@
* @return LY_EMEM If there is not enough memory for allocating error record, the @p err is not touched in that case.
* @return LY_SUCCESS if @p ecode is LY_SUCCESS, the @p err is not touched in this case.
*/
-LY_ERR ly_err_new(struct ly_err_item **err, LY_ERR ecode, LY_VECODE vecode, char *path, char *apptag, const char *err_format, ...)
+LIBYANG_API_DECL LY_ERR ly_err_new(struct ly_err_item **err, LY_ERR ecode, LY_VECODE vecode, char *path, char *apptag, const char *err_format, ...)
_FORMAT_PRINTF(6, 7);
/**
@@ -234,7 +234,7 @@
* @param[in] ptr Error record (::ly_err_item, the void pointer is here only for compatibility with a generic free()
* function) to free. With the record, also all the records (if any) connected after this one are freed.
*/
-void ly_err_free(void *ptr);
+LIBYANG_API_DECL void ly_err_free(void *ptr);
/**
* @brief Check that the type is suitable for the parser's hints (if any) in the specified format
@@ -251,7 +251,7 @@
* @param[out] err Pointer to store error information in case of failure.
* @return LY_ERR value
*/
-LY_ERR lyplg_type_check_hints(uint32_t hints, const char *value, size_t value_len, LY_DATA_TYPE type, int *base,
+LIBYANG_API_DECL LY_ERR lyplg_type_check_hints(uint32_t hints, const char *value, size_t value_len, LY_DATA_TYPE type, int *base,
struct ly_err_item **err);
/**
@@ -265,7 +265,7 @@
* @param[out] err Pointer to store error information in case of failure.
* @return LY_ERR value.
*/
-LY_ERR lyplg_type_check_status(const struct lysc_node *ctx_node, uint16_t val_flags, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL LY_ERR lyplg_type_check_status(const struct lysc_node *ctx_node, uint16_t val_flags, LY_VALUE_FORMAT format,
void *prefix_data, const char *val_name, struct ly_err_item **err);
/**
@@ -278,7 +278,7 @@
* @param[out] err Pointer to store error information in case of failure.
* @return LY_ERR value.
*/
-LY_ERR lyplg_type_lypath_check_status(const struct lysc_node *ctx_node, const struct ly_path *path,
+LIBYANG_API_DECL LY_ERR lyplg_type_lypath_check_status(const struct lysc_node *ctx_node, const struct ly_path *path,
LY_VALUE_FORMAT format, void *prefix_data, struct ly_err_item **err);
/**
@@ -297,7 +297,7 @@
* @return Resolved prefix module,
* @return NULL otherwise.
*/
-const struct lys_module *lyplg_type_identity_module(const struct ly_ctx *ctx, const struct lysc_node *ctx_node,
+LIBYANG_API_DECL const struct lys_module *lyplg_type_identity_module(const struct ly_ctx *ctx, const struct lysc_node *ctx_node,
const char *prefix, size_t prefix_len, LY_VALUE_FORMAT format, const void *prefix_data);
/**
@@ -311,7 +311,7 @@
* @return LY_ERECOMPILE if the context need to be recompiled, should be returned.
* @return LY_ERR value.
*/
-LY_ERR lyplg_type_make_implemented(struct lys_module *mod, const char **features, struct lys_glob_unres *unres);
+LIBYANG_API_DECL LY_ERR lyplg_type_make_implemented(struct lys_module *mod, const char **features, struct lys_glob_unres *unres);
/**
* @brief Get the bitmap size of a bits value bitmap.
@@ -322,7 +322,7 @@
* @param[in] type Bits type.
* @return Bitmap size in bytes.
*/
-size_t lyplg_type_bits_bitmap_size(const struct lysc_type_bits *type);
+LIBYANG_API_DECL size_t lyplg_type_bits_bitmap_size(const struct lysc_type_bits *type);
/**
* @brief Check whether a particular bit of a bitmap is set.
@@ -332,7 +332,7 @@
* @param[in] bit_position Bit position to check.
* @return Whether the bit is set or not.
*/
-ly_bool lyplg_type_bits_is_bit_set(const char *bitmap, size_t size, uint32_t bit_position);
+LIBYANG_API_DECL ly_bool lyplg_type_bits_is_bit_set(const char *bitmap, size_t size, uint32_t bit_position);
/**
* @brief Get format-specific prefix for a module.
@@ -345,7 +345,7 @@
* @return Module prefix to print.
* @return NULL on error.
*/
-const char *lyplg_type_get_prefix(const struct lys_module *mod, LY_VALUE_FORMAT format, void *prefix_data);
+LIBYANG_API_DECL const char *lyplg_type_get_prefix(const struct lys_module *mod, LY_VALUE_FORMAT format, void *prefix_data);
/**
* @brief Store used prefixes in a string into an internal libyang structure used in ::lyd_value.
@@ -364,7 +364,7 @@
* @param[in,out] prefix_data_p Resulting prefix data for the value in format @p format_p.
* @return LY_ERR value.
*/
-LY_ERR lyplg_type_prefix_data_new(const struct ly_ctx *ctx, const void *value, size_t value_len, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL LY_ERR lyplg_type_prefix_data_new(const struct ly_ctx *ctx, const void *value, size_t value_len, LY_VALUE_FORMAT format,
const void *prefix_data, LY_VALUE_FORMAT *format_p, void **prefix_data_p);
/**
* @brief Duplicate prefix data.
@@ -377,7 +377,7 @@
* @param[out] dup Duplicated prefix data.
* @return LY_ERR value.
*/
-LY_ERR lyplg_type_prefix_data_dup(const struct ly_ctx *ctx, LY_VALUE_FORMAT format, const void *orig, void **dup);
+LIBYANG_API_DECL LY_ERR lyplg_type_prefix_data_dup(const struct ly_ctx *ctx, LY_VALUE_FORMAT format, const void *orig, void **dup);
/**
* @brief Free internal prefix data.
@@ -387,7 +387,7 @@
* @param[in] format Format of the prefixes.
* @param[in] prefix_data Format-specific data to free.
*/
-void lyplg_type_prefix_data_free(LY_VALUE_FORMAT format, void *prefix_data);
+LIBYANG_API_DECL void lyplg_type_prefix_data_free(LY_VALUE_FORMAT format, void *prefix_data);
/**
* @brief Helper function to create internal schema path representation for instance-identifier value representation.
@@ -408,7 +408,7 @@
* @return LY_ERECOMPILE if the context need to be recompiled, should be returned.
* @return LY_ERR value on error.
*/
-LY_ERR lyplg_type_lypath_new(const struct ly_ctx *ctx, const char *value, size_t value_len, uint32_t options,
+LIBYANG_API_DECL LY_ERR lyplg_type_lypath_new(const struct ly_ctx *ctx, const char *value, size_t value_len, uint32_t options,
LY_VALUE_FORMAT format, void *prefix_data, const struct lysc_node *ctx_node,
struct lys_glob_unres *unres, struct ly_path **path, struct ly_err_item **err);
@@ -420,7 +420,7 @@
* @param[in] ctx libyang context.
* @param[in] path The structure ([sized array](@ref sizedarrays)) to free.
*/
-void lyplg_type_lypath_free(const struct ly_ctx *ctx, struct ly_path *path);
+LIBYANG_API_DECL void lyplg_type_lypath_free(const struct ly_ctx *ctx, struct ly_path *path);
/**
* @defgroup plugintypestoreopts Plugins: Type store callback options.
@@ -467,7 +467,7 @@
* @return LY_EINCOMPLETE in case the ::lyplg_type_validate_clb should be called to finish value validation in data,
* @return LY_ERR value on error.
*/
-typedef LY_ERR (*lyplg_type_store_clb)(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value,
+LIBYANG_API_DECL typedef LY_ERR (*lyplg_type_store_clb)(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value,
size_t value_len, uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints,
const struct lysc_node *ctx_node, struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
@@ -488,7 +488,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR value on error.
*/
-typedef LY_ERR (*lyplg_type_validate_clb)(const struct ly_ctx *ctx, const struct lysc_type *type,
+LIBYANG_API_DECL typedef LY_ERR (*lyplg_type_validate_clb)(const struct ly_ctx *ctx, const struct lysc_type *type,
const struct lyd_node *ctx_node, const struct lyd_node *tree, struct lyd_value *storage, struct ly_err_item **err);
/**
@@ -607,23 +607,23 @@
/**
* @brief Implementation of ::lyplg_type_compare_clb for a generic simple type.
*/
-LY_ERR lyplg_type_compare_simple(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_simple(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of ::lyplg_type_print_clb for a generic simple type.
*/
-const void *lyplg_type_print_simple(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_simple(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/**
* @brief Implementation of ::lyplg_type_dup_clb for a generic simple type.
*/
-LY_ERR lyplg_type_dup_simple(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
+LIBYANG_API_DECL LY_ERR lyplg_type_dup_simple(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
/**
* @brief Implementation of ::lyplg_type_free_clb for a generic simple type.
*/
-void lyplg_type_free_simple(const struct ly_ctx *ctx, struct lyd_value *value);
+LIBYANG_API_DECL void lyplg_type_free_simple(const struct ly_ctx *ctx, struct lyd_value *value);
/** @} pluginsTypesSimple */
@@ -638,30 +638,30 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in binary type.
*/
-LY_ERR lyplg_type_store_binary(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_binary(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_compare_clb for the built-in binary type.
*/
-LY_ERR lyplg_type_compare_binary(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_binary(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of ::lyplg_type_print_clb for the built-in binary type.
*/
-const void *lyplg_type_print_binary(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_binary(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/**
* @brief Implementation of ::lyplg_type_dup_clb for the built-in binary type.
*/
-LY_ERR lyplg_type_dup_binary(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
+LIBYANG_API_DECL LY_ERR lyplg_type_dup_binary(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
/**
* @brief Implementation of ::lyplg_type_free_clb for the built-in binary type.
*/
-void lyplg_type_free_binary(const struct ly_ctx *ctx, struct lyd_value *value);
+LIBYANG_API_DECL void lyplg_type_free_binary(const struct ly_ctx *ctx, struct lyd_value *value);
/** @} pluginsTypesBinary */
@@ -676,30 +676,30 @@
/**
* @brief Implementation of the ::lyplg_type_store_clb for the built-in bits type.
*/
-LY_ERR lyplg_type_store_bits(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_bits(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of the ::lyplg_type_compare_clb for the built-in bits type.
*/
-LY_ERR lyplg_type_compare_bits(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_bits(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of the ::lyplg_type_print_clb for the built-in bits type.
*/
-const void *lyplg_type_print_bits(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_bits(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/**
* @brief Implementation of the ::lyplg_type_dup_clb for the built-in bits type.
*/
-LY_ERR lyplg_type_dup_bits(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
+LIBYANG_API_DECL LY_ERR lyplg_type_dup_bits(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
/**
* @brief Implementation of the ::lyplg_type_free_clb for the built-in bits type.
*/
-void lyplg_type_free_bits(const struct ly_ctx *ctx, struct lyd_value *value);
+LIBYANG_API_DECL void lyplg_type_free_bits(const struct ly_ctx *ctx, struct lyd_value *value);
/** @} pluginsTypesBits */
@@ -714,19 +714,19 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in boolean type.
*/
-LY_ERR lyplg_type_store_boolean(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_boolean(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_compare_clb for the built-in boolean type.
*/
-LY_ERR lyplg_type_compare_boolean(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_boolean(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of ::lyplg_type_print_clb for the built-in boolean type.
*/
-const void *lyplg_type_print_boolean(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_boolean(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/** @} pluginsTypesBoolean */
@@ -742,19 +742,19 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in decimal64 type.
*/
-LY_ERR lyplg_type_store_decimal64(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_decimal64(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_compare_clb for the built-in decimal64 type.
*/
-LY_ERR lyplg_type_compare_decimal64(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_decimal64(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of ::lyplg_type_print_clb for the built-in decimal64 type.
*/
-const void *lyplg_type_print_decimal64(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_decimal64(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/** @} pluginsTypesDecimal64 */
@@ -770,7 +770,7 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in empty type.
*/
-LY_ERR lyplg_type_store_empty(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_empty(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
@@ -787,14 +787,14 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in enumeration type.
*/
-LY_ERR lyplg_type_store_enum(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_enum(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_print_clb for the built-in enumeration type.
*/
-const void *lyplg_type_print_enum(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_enum(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/** @} pluginsTypesEnumeration */
@@ -810,19 +810,19 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in identityref type.
*/
-LY_ERR lyplg_type_store_identityref(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_identityref(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_compare_clb for the built-in identityref type.
*/
-LY_ERR lyplg_type_compare_identityref(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_identityref(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of ::lyplg_type_print_clb for the built-in identityref type.
*/
-const void *lyplg_type_print_identityref(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_identityref(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/** @} pluginsTypesIdentityref */
@@ -838,36 +838,36 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in instance-identifier type.
*/
-LY_ERR lyplg_type_store_instanceid(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_instanceid(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_validate_clb for the built-in instance-identifier type.
*/
-LY_ERR lyplg_type_validate_instanceid(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *ctx_node,
+LIBYANG_API_DECL LY_ERR lyplg_type_validate_instanceid(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *ctx_node,
const struct lyd_node *tree, struct lyd_value *storage, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_compare_clb for the built-in instance-identifier type.
*/
-LY_ERR lyplg_type_compare_instanceid(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_instanceid(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of ::lyplg_type_print_clb for the built-in instance-identifier type.
*/
-const void *lyplg_type_print_instanceid(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_instanceid(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/**
* @brief Implementation of ::lyplg_type_dup_clb for the built-in instance-identifier type.
*/
-LY_ERR lyplg_type_dup_instanceid(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
+LIBYANG_API_DECL LY_ERR lyplg_type_dup_instanceid(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
/**
* @brief Implementation of ::lyplg_type_free_clb for the built-in instance-identifier type.
*/
-void lyplg_type_free_instanceid(const struct ly_ctx *ctx, struct lyd_value *value);
+LIBYANG_API_DECL void lyplg_type_free_instanceid(const struct ly_ctx *ctx, struct lyd_value *value);
/** @} pluginsTypesInstanceid */
@@ -882,37 +882,37 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in signed integer types.
*/
-LY_ERR lyplg_type_store_int(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_int(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_compare_clb for the built-in signed integer types.
*/
-LY_ERR lyplg_type_compare_int(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_int(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of ::lyplg_type_print_clb for the built-in signed integer types.
*/
-const void *lyplg_type_print_int(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_int(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in unsigned integer types.
*/
-LY_ERR lyplg_type_store_uint(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_uint(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_compare_clb for the built-in unsigned integer types.
*/
-LY_ERR lyplg_type_compare_uint(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_uint(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of ::lyplg_type_print_clb for the built-in unsigned integer types.
*/
-const void *lyplg_type_print_uint(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_uint(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/** @} pluginsTypesInteger */
@@ -928,36 +928,36 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in leafref type.
*/
-LY_ERR lyplg_type_store_leafref(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_leafref(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_compare_clb for the built-in leafref type.
*/
-LY_ERR lyplg_type_compare_leafref(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_leafref(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of ::lyplg_type_print_clb for the built-in leafref type.
*/
-const void *lyplg_type_print_leafref(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_leafref(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/**
* @brief Implementation of ::lyplg_type_dup_clb for the built-in leafref type.
*/
-LY_ERR lyplg_type_dup_leafref(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
+LIBYANG_API_DECL LY_ERR lyplg_type_dup_leafref(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
/**
* @brief Implementation of ::lyplg_type_validate_clb for the built-in leafref type.
*/
-LY_ERR lyplg_type_validate_leafref(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *ctx_node,
+LIBYANG_API_DECL LY_ERR lyplg_type_validate_leafref(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *ctx_node,
const struct lyd_node *tree, struct lyd_value *storage, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_free_clb for the built-in leafref type.
*/
-void lyplg_type_free_leafref(const struct ly_ctx *ctx, struct lyd_value *value);
+LIBYANG_API_DECL void lyplg_type_free_leafref(const struct ly_ctx *ctx, struct lyd_value *value);
/** @} pluginsTypesLeafref */
@@ -972,7 +972,7 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in string type.
*/
-LY_ERR lyplg_type_store_string(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_string(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
@@ -989,36 +989,36 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the built-in union type.
*/
-LY_ERR lyplg_type_store_union(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_union(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_compare_clb for the built-in union type.
*/
-LY_ERR lyplg_type_compare_union(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_union(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of ::lyplg_type_print_clb for the built-in union type.
*/
-const void *lyplg_type_print_union(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_union(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/**
* @brief Implementation of ::lyplg_type_dup_clb for the built-in union type.
*/
-LY_ERR lyplg_type_dup_union(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
+LIBYANG_API_DECL LY_ERR lyplg_type_dup_union(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
/**
* @brief Implementation of ::lyplg_type_validate_clb for the built-in union type.
*/
-LY_ERR lyplg_type_validate_union(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *ctx_node,
+LIBYANG_API_DECL LY_ERR lyplg_type_validate_union(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *ctx_node,
const struct lyd_node *tree, struct lyd_value *storage, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_free_clb for the built-in union type.
*/
-void lyplg_type_free_union(const struct ly_ctx *ctx, struct lyd_value *value);
+LIBYANG_API_DECL void lyplg_type_free_union(const struct ly_ctx *ctx, struct lyd_value *value);
/** @} pluginsTypesUnion */
@@ -1033,30 +1033,30 @@
/**
* @brief Implementation of ::lyplg_type_store_clb for the ietf-yang-types xpath1.0 type.
*/
-LY_ERR lyplg_type_store_xpath10(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_store_xpath10(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
* @brief Implementation of ::lyplg_type_compare_clb for the ietf-yang-types xpath1.0 type.
*/
-LY_ERR lyplg_type_compare_xpath10(const struct lyd_value *val1, const struct lyd_value *val2);
+LIBYANG_API_DECL LY_ERR lyplg_type_compare_xpath10(const struct lyd_value *val1, const struct lyd_value *val2);
/**
* @brief Implementation of ::lyplg_type_print_clb for the ietf-yang-types xpath1.0 type.
*/
-const void *lyplg_type_print_xpath10(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
+LIBYANG_API_DECL const void *lyplg_type_print_xpath10(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len);
/**
* @brief Implementation of ::lyplg_type_dup_clb for the ietf-yang-types xpath1.0 type.
*/
-LY_ERR lyplg_type_dup_xpath10(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
+LIBYANG_API_DECL LY_ERR lyplg_type_dup_xpath10(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
/**
* @brief Implementation of ::lyplg_type_free_clb for the ietf-yang-types xpath1.0 type.
*/
-void lyplg_type_free_xpath10(const struct ly_ctx *ctx, struct lyd_value *value);
+LIBYANG_API_DECL void lyplg_type_free_xpath10(const struct ly_ctx *ctx, struct lyd_value *value);
/** @} pluginsTypesXpath10 */
@@ -1074,7 +1074,7 @@
* @param[out] err Error information in case of failure. The error structure can be freed by ::ly_err_free().
* @return LY_ERR value according to the result of the parsing and validation.
*/
-LY_ERR lyplg_type_parse_int(const char *datatype, int base, int64_t min, int64_t max, const char *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_parse_int(const char *datatype, int base, int64_t min, int64_t max, const char *value, size_t value_len,
int64_t *ret, struct ly_err_item **err);
/**
@@ -1090,7 +1090,7 @@
* @param[out] err Error information in case of failure. The error structure can be freed by ::ly_err_free().
* @return LY_ERR value according to the result of the parsing and validation.
*/
-LY_ERR lyplg_type_parse_uint(const char *datatype, int base, uint64_t max, const char *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyplg_type_parse_uint(const char *datatype, int base, uint64_t max, const char *value, size_t value_len,
uint64_t *ret, struct ly_err_item **err);
/**
@@ -1104,7 +1104,7 @@
* @param[out] err Error information in case of failure. The error structure can be freed by ::ly_err_free().
* @return LY_ERR value according to the result of the parsing and validation.
*/
-LY_ERR lyplg_type_parse_dec64(uint8_t fraction_digits, const char *value, size_t value_len, int64_t *ret, struct ly_err_item **err);
+LIBYANG_API_DECL LY_ERR lyplg_type_parse_dec64(uint8_t fraction_digits, const char *value, size_t value_len, int64_t *ret, struct ly_err_item **err);
/**
* @brief Decide if the @p derived identity is derived from (based on) the @p base identity.
@@ -1114,7 +1114,7 @@
* @return LY_SUCCESS if @p derived IS based on the @p base identity.
* @return LY_ENOTFOUND if @p derived IS NOT not based on the @p base identity.
*/
-LY_ERR lyplg_type_identity_isderived(const struct lysc_ident *base, const struct lysc_ident *derived);
+LIBYANG_API_DECL LY_ERR lyplg_type_identity_isderived(const struct lysc_ident *base, const struct lysc_ident *derived);
/**
* @brief Data type validator for a range/length-restricted values.
@@ -1127,7 +1127,7 @@
* @param[out] err Error information in case of failure. The error structure can be freed by ::ly_err_free().
* @return LY_ERR value according to the result of the validation.
*/
-LY_ERR lyplg_type_validate_range(LY_DATA_TYPE basetype, struct lysc_range *range, int64_t value, const char *strval,
+LIBYANG_API_DECL LY_ERR lyplg_type_validate_range(LY_DATA_TYPE basetype, struct lysc_range *range, int64_t value, const char *strval,
size_t strval_len, struct ly_err_item **err);
/**
@@ -1142,7 +1142,7 @@
* @return LY_EVALID when @p does not match any of the patterns.
* @return LY_ESYS in case of PCRE2 error.
*/
-LY_ERR lyplg_type_validate_patterns(struct lysc_pattern **patterns, const char *str, size_t str_len, struct ly_err_item **err);
+LIBYANG_API_DECL LY_ERR lyplg_type_validate_patterns(struct lysc_pattern **patterns, const char *str, size_t str_len, struct ly_err_item **err);
/**
* @brief Find leafref target in data.
@@ -1155,7 +1155,7 @@
* @param[out] errmsg Error message in case of error.
* @return LY_ERR value.
*/
-LY_ERR lyplg_type_resolve_leafref(const struct lysc_type_leafref *lref, const struct lyd_node *node, struct lyd_value *value,
+LIBYANG_API_DECL LY_ERR lyplg_type_resolve_leafref(const struct lysc_type_leafref *lref, const struct lyd_node *node, struct lyd_value *value,
const struct lyd_node *tree, struct lyd_node **target, char **errmsg);
/** @} pluginsTypes */
diff --git a/src/plugins_types/binary.c b/src/plugins_types/binary.c
index 5da2fc1..114a17d 100644
--- a/src/plugins_types/binary.c
+++ b/src/plugins_types/binary.c
@@ -211,7 +211,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_binary(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
@@ -283,7 +283,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_compare_binary(const struct lyd_value *val1, const struct lyd_value *val2)
{
struct lyd_value_binary *v1, *v2;
@@ -301,7 +301,7 @@
return LY_SUCCESS;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_binary(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
{
@@ -343,7 +343,7 @@
return value->_canonical;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_dup_binary(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
{
LY_ERR ret;
@@ -373,7 +373,7 @@
return ret;
}
-API void
+LIBYANG_API_DEF void
lyplg_type_free_binary(const struct ly_ctx *ctx, struct lyd_value *value)
{
struct lyd_value_binary *val;
diff --git a/src/plugins_types/bits.c b/src/plugins_types/bits.c
index d065824..5d198e3 100644
--- a/src/plugins_types/bits.c
+++ b/src/plugins_types/bits.c
@@ -51,7 +51,7 @@
# define BITS_BITMAP_BYTE(bitmap, size, idx) (bitmap + idx)
#endif
-API size_t
+LIBYANG_API_DEF size_t
lyplg_type_bits_bitmap_size(const struct lysc_type_bits *type)
{
size_t needed_bytes, size;
@@ -79,7 +79,7 @@
return size;
}
-API ly_bool
+LIBYANG_API_DEF ly_bool
lyplg_type_bits_is_bit_set(const char *bitmap, size_t size, uint32_t bit_position)
{
char bitmask;
@@ -285,7 +285,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_bits(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
@@ -367,7 +367,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_compare_bits(const struct lyd_value *val1, const struct lyd_value *val2)
{
struct lyd_value_bits *v1, *v2;
@@ -386,7 +386,7 @@
return LY_SUCCESS;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_bits(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
{
@@ -428,7 +428,7 @@
return value->_canonical;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_dup_bits(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
{
LY_ERR ret;
@@ -468,7 +468,7 @@
return ret;
}
-API void
+LIBYANG_API_DEF void
lyplg_type_free_bits(const struct ly_ctx *ctx, struct lyd_value *value)
{
struct lyd_value_bits *val;
diff --git a/src/plugins_types/boolean.c b/src/plugins_types/boolean.c
index e16db4f..f8b19f6 100644
--- a/src/plugins_types/boolean.c
+++ b/src/plugins_types/boolean.c
@@ -33,7 +33,7 @@
* | 1 | yes | `int8_t *` | 0 for false, otherwise true |
*/
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_boolean(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
@@ -103,7 +103,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_compare_boolean(const struct lyd_value *val1, const struct lyd_value *val2)
{
if (val1->realtype != val2->realtype) {
@@ -116,7 +116,7 @@
return LY_SUCCESS;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_boolean(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format,
void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
{
diff --git a/src/plugins_types/decimal64.c b/src/plugins_types/decimal64.c
index 41cfe9a..8616e2d 100644
--- a/src/plugins_types/decimal64.c
+++ b/src/plugins_types/decimal64.c
@@ -79,7 +79,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_decimal64(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
@@ -157,7 +157,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_compare_decimal64(const struct lyd_value *val1, const struct lyd_value *val2)
{
if (val1->realtype != val2->realtype) {
@@ -171,7 +171,7 @@
return LY_SUCCESS;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_decimal64(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format,
void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
{
diff --git a/src/plugins_types/empty.c b/src/plugins_types/empty.c
index f3b1478..d84634f 100644
--- a/src/plugins_types/empty.c
+++ b/src/plugins_types/empty.c
@@ -33,7 +33,7 @@
* | 0 | yes | `void` | none |
*/
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_empty(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
diff --git a/src/plugins_types/enumeration.c b/src/plugins_types/enumeration.c
index 78da069..91ca822 100644
--- a/src/plugins_types/enumeration.c
+++ b/src/plugins_types/enumeration.c
@@ -36,7 +36,7 @@
* | 4 | yes | `int32 *` | assigned little-endian value of the enum |
*/
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_enum(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
@@ -134,7 +134,7 @@
return ret;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_enum(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format,
void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
{
diff --git a/src/plugins_types/identityref.c b/src/plugins_types/identityref.c
index 65061ab..7eee215 100644
--- a/src/plugins_types/identityref.c
+++ b/src/plugins_types/identityref.c
@@ -219,7 +219,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_identityref(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
@@ -286,7 +286,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_compare_identityref(const struct lyd_value *val1, const struct lyd_value *val2)
{
if (val1->realtype != val2->realtype) {
@@ -299,7 +299,7 @@
return LY_ENOT;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_identityref(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len)
{
diff --git a/src/plugins_types/instanceid.c b/src/plugins_types/instanceid.c
index d958567..4481067 100644
--- a/src/plugins_types/instanceid.c
+++ b/src/plugins_types/instanceid.c
@@ -141,7 +141,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_instanceid(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
@@ -212,7 +212,7 @@
}
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_validate_instanceid(const struct ly_ctx *ctx, const struct lysc_type *UNUSED(type),
const struct lyd_node *ctx_node, const struct lyd_node *tree, struct lyd_value *storage,
struct ly_err_item **err)
@@ -239,7 +239,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_compare_instanceid(const struct lyd_value *val1, const struct lyd_value *val2)
{
LY_ARRAY_COUNT_TYPE u, v;
@@ -296,7 +296,7 @@
return LY_SUCCESS;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_instanceid(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len)
{
@@ -323,7 +323,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_dup_instanceid(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
{
LY_ERR ret;
@@ -346,7 +346,7 @@
return ret;
}
-API void
+LIBYANG_API_DEF void
lyplg_type_free_instanceid(const struct ly_ctx *ctx, struct lyd_value *value)
{
lydict_remove(ctx, value->_canonical);
diff --git a/src/plugins_types/integer.c b/src/plugins_types/integer.c
index 5a50306..0903365 100644
--- a/src/plugins_types/integer.c
+++ b/src/plugins_types/integer.c
@@ -44,7 +44,7 @@
[LY_TYPE_UINT8] = 1, [LY_TYPE_UINT16] = 2, [LY_TYPE_UINT32] = 4, [LY_TYPE_UINT64] = 8
};
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_int(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
@@ -172,7 +172,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_compare_int(const struct lyd_value *val1, const struct lyd_value *val2)
{
if (val1->realtype != val2->realtype) {
@@ -206,7 +206,7 @@
return LY_SUCCESS;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_int(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format,
void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
{
@@ -262,7 +262,7 @@
return value->_canonical;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_uint(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
@@ -370,7 +370,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_compare_uint(const struct lyd_value *val1, const struct lyd_value *val2)
{
if (val1->realtype != val2->realtype) {
@@ -404,7 +404,7 @@
return LY_SUCCESS;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_uint(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format,
void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
{
diff --git a/src/plugins_types/leafref.c b/src/plugins_types/leafref.c
index 44d1644..8ab3fc5 100644
--- a/src/plugins_types/leafref.c
+++ b/src/plugins_types/leafref.c
@@ -35,7 +35,7 @@
* | exact same format as the leafref target ||||
*/
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_leafref(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
@@ -62,7 +62,7 @@
}
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_validate_leafref(const struct ly_ctx *UNUSED(ctx), const struct lysc_type *type, const struct lyd_node *ctx_node,
const struct lyd_node *tree, struct lyd_value *storage, struct ly_err_item **err)
{
@@ -88,26 +88,26 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_compare_leafref(const struct lyd_value *val1, const struct lyd_value *val2)
{
return val1->realtype->plugin->compare(val1, val2);
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_leafref(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len)
{
return value->realtype->plugin->print(ctx, value, format, prefix_data, dynamic, value_len);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_dup_leafref(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
{
return original->realtype->plugin->duplicate(ctx, original, dup);
}
-API void
+LIBYANG_API_DEF void
lyplg_type_free_leafref(const struct ly_ctx *ctx, struct lyd_value *value)
{
value->realtype->plugin->free(ctx, value);
diff --git a/src/plugins_types/string.c b/src/plugins_types/string.c
index efebf4d..4f988ef 100644
--- a/src/plugins_types/string.c
+++ b/src/plugins_types/string.c
@@ -33,7 +33,7 @@
* | string length | yes | `char *` | string itself |
*/
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_string(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
diff --git a/src/plugins_types/union.c b/src/plugins_types/union.c
index 5295d80..d3b168d 100644
--- a/src/plugins_types/union.c
+++ b/src/plugins_types/union.c
@@ -313,7 +313,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_union(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
@@ -367,7 +367,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_validate_union(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *ctx_node,
const struct lyd_node *tree, struct lyd_value *storage, struct ly_err_item **err)
{
@@ -417,7 +417,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_compare_union(const struct lyd_value *val1, const struct lyd_value *val2)
{
if (val1->realtype != val2->realtype) {
@@ -489,7 +489,7 @@
return ret;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_union(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len)
{
@@ -525,7 +525,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_dup_union(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
{
LY_ERR ret = LY_SUCCESS;
@@ -568,7 +568,7 @@
return ret;
}
-API void
+LIBYANG_API_DEF void
lyplg_type_free_union(const struct ly_ctx *ctx, struct lyd_value *value)
{
struct lyd_value_union *val;
diff --git a/src/plugins_types/xpath1.0.c b/src/plugins_types/xpath1.0.c
index 25b3589..55c38c0 100644
--- a/src/plugins_types/xpath1.0.c
+++ b/src/plugins_types/xpath1.0.c
@@ -266,7 +266,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_store_xpath10(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
@@ -337,7 +337,7 @@
return ret;
}
-API const void *
+LIBYANG_API_DEF const void *
lyplg_type_print_xpath10(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool *dynamic, size_t *value_len)
{
@@ -374,7 +374,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyplg_type_dup_xpath10(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
{
LY_ERR ret = LY_SUCCESS;
@@ -406,7 +406,7 @@
return ret;
}
-API void
+LIBYANG_API_DEF void
lyplg_type_free_xpath10(const struct ly_ctx *ctx, struct lyd_value *value)
{
struct lyd_value_xpath10 *val;
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;
diff --git a/src/printer_data.h b/src/printer_data.h
index a9bc618..ff938de 100644
--- a/src/printer_data.h
+++ b/src/printer_data.h
@@ -109,7 +109,7 @@
* @param[in] options [Data printer flags](@ref dataprinterflags) except ::LYD_PRINT_WITHSIBLINGS.
* @return LY_ERR value.
*/
-LY_ERR lyd_print_all(struct ly_out *out, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
+LIBYANG_API_DECL LY_ERR lyd_print_all(struct ly_out *out, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
/**
* @brief Print the selected data subtree.
@@ -120,7 +120,7 @@
* @param[in] options [Data printer flags](@ref dataprinterflags) except ::LYD_PRINT_WITHSIBLINGS.
* @return LY_ERR value.
*/
-LY_ERR lyd_print_tree(struct ly_out *out, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
+LIBYANG_API_DECL LY_ERR lyd_print_tree(struct ly_out *out, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
/**
* @brief Print data tree in the specified format.
@@ -131,7 +131,7 @@
* @param[in] options [Data printer flags](@ref dataprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lyd_print_mem(char **strp, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
+LIBYANG_API_DECL LY_ERR lyd_print_mem(char **strp, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
/**
* @brief Print data tree in the specified format.
@@ -142,7 +142,7 @@
* @param[in] options [Data printer flags](@ref dataprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lyd_print_fd(int fd, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
+LIBYANG_API_DECL LY_ERR lyd_print_fd(int fd, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
/**
* @brief Print data tree in the specified format.
@@ -153,7 +153,7 @@
* @param[in] options [Data printer flags](@ref dataprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lyd_print_file(FILE *f, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
+LIBYANG_API_DECL LY_ERR lyd_print_file(FILE *f, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
/**
* @brief Print data tree in the specified format.
@@ -164,7 +164,7 @@
* @param[in] options [Data printer flags](@ref dataprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lyd_print_path(const char *path, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
+LIBYANG_API_DECL LY_ERR lyd_print_path(const char *path, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
/**
* @brief Print data tree in the specified format.
@@ -176,7 +176,7 @@
* @param[in] options [Data printer flags](@ref dataprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lyd_print_clb(ly_write_clb writeclb, void *user_data, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
+LIBYANG_API_DECL LY_ERR lyd_print_clb(ly_write_clb writeclb, void *user_data, const struct lyd_node *root, LYD_FORMAT format, uint32_t options);
#ifdef __cplusplus
}
diff --git a/src/printer_schema.c b/src/printer_schema.c
index 80eb2da..075c519 100644
--- a/src/printer_schema.c
+++ b/src/printer_schema.c
@@ -23,7 +23,7 @@
#include "printer_internal.h"
#include "tree_schema.h"
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_print_module(struct ly_out *out, const struct lys_module *module, LYS_OUTFORMAT format, size_t line_length,
uint32_t options)
{
@@ -84,7 +84,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_print_submodule(struct ly_out *out, const struct lysp_submodule *submodule, LYS_OUTFORMAT format,
size_t line_length, uint32_t options)
{
@@ -132,7 +132,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_print_mem(char **strp, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options)
{
struct ly_out *out;
@@ -146,7 +146,7 @@
return lys_print_(out, module, format, options);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_print_fd(int fd, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options)
{
struct ly_out *out;
@@ -157,7 +157,7 @@
return lys_print_(out, module, format, options);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_print_file(FILE *f, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options)
{
struct ly_out *out;
@@ -168,7 +168,7 @@
return lys_print_(out, module, format, options);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_print_path(const char *path, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options)
{
struct ly_out *out;
@@ -179,7 +179,7 @@
return lys_print_(out, module, format, options);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_print_clb(ly_write_clb writeclb, void *user_data, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options)
{
struct ly_out *out;
@@ -190,7 +190,7 @@
return lys_print_(out, module, format, options);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_print_node(struct ly_out *out, const struct lysc_node *node, LYS_OUTFORMAT format, size_t line_length, uint32_t options)
{
LY_ERR ret;
diff --git a/src/printer_schema.h b/src/printer_schema.h
index 7306272..83c134b 100644
--- a/src/printer_schema.h
+++ b/src/printer_schema.h
@@ -123,7 +123,7 @@
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lys_print_module(struct ly_out *out, const struct lys_module *module, LYS_OUTFORMAT format, size_t line_length,
+LIBYANG_API_DECL LY_ERR lys_print_module(struct ly_out *out, const struct lys_module *module, LYS_OUTFORMAT format, size_t line_length,
uint32_t options);
/**
@@ -136,7 +136,7 @@
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lys_print_submodule(struct ly_out *out, const struct lysp_submodule *submodule, LYS_OUTFORMAT format,
+LIBYANG_API_DECL LY_ERR lys_print_submodule(struct ly_out *out, const struct lysp_submodule *submodule, LYS_OUTFORMAT format,
size_t line_length, uint32_t options);
/**
@@ -152,7 +152,7 @@
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lys_print_mem(char **strp, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options);
+LIBYANG_API_DECL LY_ERR lys_print_mem(char **strp, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options);
/**
* @brief Print schema tree in the specified format into a file descriptor.
@@ -166,7 +166,7 @@
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lys_print_fd(int fd, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options);
+LIBYANG_API_DECL LY_ERR lys_print_fd(int fd, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options);
/**
* @brief Print schema tree in the specified format into a file stream.
@@ -180,7 +180,7 @@
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lys_print_file(FILE *f, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options);
+LIBYANG_API_DECL LY_ERR lys_print_file(FILE *f, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options);
/**
* @brief Print schema tree in the specified format into a file.
@@ -194,7 +194,7 @@
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lys_print_path(const char *path, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options);
+LIBYANG_API_DECL LY_ERR lys_print_path(const char *path, const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options);
/**
* @brief Print schema tree in the specified format using a provided callback.
@@ -209,7 +209,7 @@
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lys_print_clb(ly_write_clb writeclb, void *user_data,
+LIBYANG_API_DECL LY_ERR lys_print_clb(ly_write_clb writeclb, void *user_data,
const struct lys_module *module, LYS_OUTFORMAT format, uint32_t options);
/**
@@ -222,7 +222,7 @@
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lys_print_node(struct ly_out *out, const struct lysc_node *node, LYS_OUTFORMAT format, size_t line_length, uint32_t options);
+LIBYANG_API_DECL LY_ERR lys_print_node(struct ly_out *out, const struct lysc_node *node, LYS_OUTFORMAT format, size_t line_length, uint32_t options);
/** @} schematree */
diff --git a/src/schema_compile.c b/src/schema_compile.c
index 179d3c0..f84d687 100644
--- a/src/schema_compile.c
+++ b/src/schema_compile.c
@@ -145,7 +145,7 @@
return orig;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lysc_ext_substmt(const struct lysc_ext_instance *ext, enum ly_stmt substmt, void **instance_p, enum ly_stmt_cardinality *cardinality_p)
{
LY_ARRAY_COUNT_TYPE u;
diff --git a/src/schema_features.c b/src/schema_features.c
index 28830a6..2189046 100644
--- a/src/schema_features.c
+++ b/src/schema_features.c
@@ -84,7 +84,7 @@
return LY_ENOT;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lysc_iffeature_value(const struct lysc_iffeature *iff)
{
size_t index_e = 0, index_f = 0;
@@ -97,7 +97,7 @@
return LY_ENOT;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_identity_iffeature_value(const struct lysc_ident *ident)
{
LY_ARRAY_COUNT_TYPE u, v;
@@ -141,7 +141,7 @@
return LY_SUCCESS;
}
-API struct lysp_feature *
+LIBYANG_API_DEF struct lysp_feature *
lysp_feature_next(const struct lysp_feature *last, const struct lysp_module *pmod, uint32_t *idx)
{
struct lysp_feature *features;
@@ -211,7 +211,7 @@
return NULL;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_feature_value(const struct lys_module *module, const char *feature)
{
const struct lysp_feature *f;
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;
diff --git a/src/set.h b/src/set.h
index 9312af8..415323a 100644
--- a/src/set.h
+++ b/src/set.h
@@ -61,7 +61,7 @@
* @return LY_EINVAL in case of NULL @p set parameter.
* @return LY_EMEM in case of memory allocation failure.
*/
-LY_ERR ly_set_new(struct ly_set **set_p);
+LIBYANG_API_DECL LY_ERR ly_set_new(struct ly_set **set_p);
/**
* @brief Duplicate the existing set.
@@ -75,7 +75,7 @@
* @return LY_EMEM in case of memory allocation failure.
* @return LY_EINVAL in case of invalid parameters.
*/
-LY_ERR ly_set_dup(const struct ly_set *set, void *(*duplicator)(void *obj), struct ly_set **newset_p);
+LIBYANG_API_DECL LY_ERR ly_set_dup(const struct ly_set *set, void *(*duplicator)(void *obj), struct ly_set **newset_p);
/**
* @brief Add an object into the set
@@ -90,7 +90,7 @@
* @return LY_EINVAL in case of invalid input parameters.
* @return LY_EMEM in case of memory allocation failure.
*/
-LY_ERR ly_set_add(struct ly_set *set, void *object, ly_bool list, uint32_t *index_p);
+LIBYANG_API_DECL LY_ERR ly_set_add(struct ly_set *set, void *object, ly_bool list, uint32_t *index_p);
/**
* @brief Add all objects from \p src to \p trg.
@@ -107,7 +107,7 @@
* @return LY_EINVAL in case of invalid input parameters.
* @return LY_EMEM in case of memory allocation failure.
*/
-LY_ERR ly_set_merge(struct ly_set *trg, const struct ly_set *src, ly_bool list, void *(*duplicator)(void *obj));
+LIBYANG_API_DECL LY_ERR ly_set_merge(struct ly_set *trg, const struct ly_set *src, ly_bool list, void *(*duplicator)(void *obj));
/**
* @brief Learn whether the set contains the specified object.
@@ -117,7 +117,7 @@
* @param[out] index_p Optional pointer to return index of the searched @p object.
* @return Boolean value whether the @p object was found in the @p set.
*/
-ly_bool ly_set_contains(const struct ly_set *set, void *object, uint32_t *index_p);
+LIBYANG_API_DECL ly_bool ly_set_contains(const struct ly_set *set, void *object, uint32_t *index_p);
/**
* @brief Remove all objects from the set, but keep the set container for further use.
@@ -125,7 +125,7 @@
* @param[in] set Set to clean.
* @param[in] destructor Optional function to free the objects in the set.
*/
-void ly_set_clean(struct ly_set *set, void (*destructor)(void *obj));
+LIBYANG_API_DECL void ly_set_clean(struct ly_set *set, void (*destructor)(void *obj));
/**
* @brief Remove an object from the set.
@@ -138,7 +138,7 @@
* @param[in] destructor Optional function to free the objects being removed.
* @return LY_ERR return value.
*/
-LY_ERR ly_set_rm(struct ly_set *set, void *object, void (*destructor)(void *obj));
+LIBYANG_API_DECL LY_ERR ly_set_rm(struct ly_set *set, void *object, void (*destructor)(void *obj));
/**
* @brief Remove an object on the specific set index.
@@ -151,7 +151,7 @@
* @param[in] destructor Optional function to free the objects being removed.
* @return LY_ERR return value.
*/
-LY_ERR ly_set_rm_index(struct ly_set *set, uint32_t index, void (*destructor)(void *obj));
+LIBYANG_API_DECL LY_ERR ly_set_rm_index(struct ly_set *set, uint32_t index, void (*destructor)(void *obj));
/**
* @brief Free the ::ly_set data. If the destructor is not provided, it frees only the set structure
@@ -160,7 +160,7 @@
* @param[in] set The set to be freed.
* @param[in] destructor Optional function to free the objects in the set.
*/
-void ly_set_free(struct ly_set *set, void (*destructor)(void *obj));
+LIBYANG_API_DECL void ly_set_free(struct ly_set *set, void (*destructor)(void *obj));
/**
* @brief Alternative to the ::ly_set_free() for static ::ly_set objects - in contrast to ::ly_set_free()
@@ -169,7 +169,7 @@
* @param[in] set The set to be erased.
* @param[in] destructor Optional function to free the objects in the set.
*/
-void ly_set_erase(struct ly_set *set, void (*destructor)(void *obj));
+LIBYANG_API_DECL void ly_set_erase(struct ly_set *set, void (*destructor)(void *obj));
/** @} lyset */
diff --git a/src/tree_data.c b/src/tree_data.c
index c996d39..c9dd7f7 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -155,7 +155,7 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_value_validate(const struct ly_ctx *ctx, const struct lysc_node *schema, const char *value, size_t value_len,
const struct lyd_node *ctx_node, const struct lysc_type **realtype, const char **canonical)
{
@@ -230,7 +230,7 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_value_compare(const struct lyd_node_term *node, const char *value, size_t value_len)
{
LY_ERR ret = LY_SUCCESS;
@@ -256,7 +256,7 @@
return ret;
}
-API ly_bool
+LIBYANG_API_DEF ly_bool
lyd_is_default(const struct lyd_node *node)
{
const struct lysc_node_leaf *leaf;
@@ -414,7 +414,7 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_parse_ext_data(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree)
{
@@ -427,7 +427,7 @@
return lyd_parse(ctx, ext, parent, tree, in, format, parse_options, validate_options, NULL);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_parse_data(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree)
{
@@ -438,7 +438,7 @@
return lyd_parse(ctx, NULL, parent, tree, in, format, parse_options, validate_options, NULL);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_parse_data_mem(const struct ly_ctx *ctx, const char *data, LYD_FORMAT format, uint32_t parse_options,
uint32_t validate_options, struct lyd_node **tree)
{
@@ -452,7 +452,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_parse_data_fd(const struct ly_ctx *ctx, int fd, LYD_FORMAT format, uint32_t parse_options, uint32_t validate_options,
struct lyd_node **tree)
{
@@ -466,7 +466,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_parse_data_path(const struct ly_ctx *ctx, const char *path, LYD_FORMAT format, uint32_t parse_options,
uint32_t validate_options, struct lyd_node **tree)
{
@@ -619,7 +619,7 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_parse_op(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op)
{
@@ -628,7 +628,7 @@
return lyd_parse_op_(ctx, NULL, parent, in, format, data_type, tree, op);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_parse_ext_op(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op)
{
@@ -865,7 +865,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_inner(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
struct lyd_node **node)
{
@@ -895,7 +895,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_ext_inner(const struct lysc_ext_instance *ext, const char *name, struct lyd_node **node)
{
struct lyd_node *ret = NULL;
@@ -989,7 +989,7 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_list(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
struct lyd_node **node, ...)
{
@@ -1004,7 +1004,7 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_list_bin(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
struct lyd_node **node, ...)
{
@@ -1019,7 +1019,7 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_list_canon(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
struct lyd_node **node, ...)
{
@@ -1034,7 +1034,7 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_ext_list(const struct lysc_ext_instance *ext, const char *name, struct lyd_node **node, ...)
{
struct lyd_node *ret = NULL, *key;
@@ -1081,7 +1081,7 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_list2(struct lyd_node *parent, const struct lys_module *module, const char *name, const char *keys,
ly_bool output, struct lyd_node **node)
{
@@ -1165,28 +1165,28 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_term(struct lyd_node *parent, const struct lys_module *module, const char *name, const char *val_str,
ly_bool output, struct lyd_node **node)
{
return _lyd_new_term(parent, module, name, val_str, val_str ? strlen(val_str) : 0, LY_VALUE_JSON, output, node);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_term_bin(struct lyd_node *parent, const struct lys_module *module, const char *name, const void *value,
size_t value_len, ly_bool output, struct lyd_node **node)
{
return _lyd_new_term(parent, module, name, value, value_len, LY_VALUE_LYB, output, node);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_term_canon(struct lyd_node *parent, const struct lys_module *module, const char *name, const char *val_str,
ly_bool output, struct lyd_node **node)
{
return _lyd_new_term(parent, module, name, val_str, val_str ? strlen(val_str) : 0, LY_VALUE_CANON, output, node);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_ext_term(const struct lysc_ext_instance *ext, const char *name, const char *val_str, struct lyd_node **node)
{
LY_ERR rc;
@@ -1214,7 +1214,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_any(struct lyd_node *parent, const struct lys_module *module, const char *name, const void *value,
ly_bool use_value, LYD_ANYDATA_VALUETYPE value_type, ly_bool output, struct lyd_node **node)
{
@@ -1243,7 +1243,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_ext_any(const struct lysc_ext_instance *ext, const char *name, const void *value, ly_bool use_value,
LYD_ANYDATA_VALUETYPE value_type, struct lyd_node **node)
{
@@ -1270,7 +1270,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_meta(const struct ly_ctx *ctx, struct lyd_node *parent, const struct lys_module *module, const char *name,
const char *val_str, ly_bool clear_dflt, struct lyd_meta **meta)
{
@@ -1313,7 +1313,7 @@
NULL, LYD_HINT_DATA, clear_dflt, NULL);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_meta2(const struct ly_ctx *ctx, struct lyd_node *parent, ly_bool clear_dflt, const struct lyd_attr *attr,
struct lyd_meta **meta)
{
@@ -1353,7 +1353,7 @@
NULL, attr->format, attr->val_prefix_data, attr->hints, clear_dflt, NULL);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_opaq(struct lyd_node *parent, const struct ly_ctx *ctx, const char *name, const char *value,
const char *prefix, const char *module_name, struct lyd_node **node)
{
@@ -1381,7 +1381,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_opaq2(struct lyd_node *parent, const struct ly_ctx *ctx, const char *name, const char *value,
const char *prefix, const char *module_ns, struct lyd_node **node)
{
@@ -1409,7 +1409,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_attr(struct lyd_node *parent, const char *module_name, const char *name, const char *value,
struct lyd_attr **attr)
{
@@ -1459,7 +1459,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_attr2(struct lyd_node *parent, const char *module_ns, const char *name, const char *value,
struct lyd_attr **attr)
{
@@ -1596,7 +1596,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_change_term(struct lyd_node *term, const char *val_str)
{
LY_CHECK_ARG_RET(NULL, term, term->schema, term->schema->nodetype & LYD_NODE_TERM, LY_EINVAL);
@@ -1604,7 +1604,7 @@
return _lyd_change_term(term, val_str, val_str ? strlen(val_str) : 0, LY_VALUE_JSON);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_change_term_bin(struct lyd_node *term, const void *value, size_t value_len)
{
LY_CHECK_ARG_RET(NULL, term, term->schema, term->schema->nodetype & LYD_NODE_TERM, LY_EINVAL);
@@ -1612,7 +1612,7 @@
return _lyd_change_term(term, value, value_len, LY_VALUE_LYB);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_change_term_canon(struct lyd_node *term, const char *val_str)
{
LY_CHECK_ARG_RET(NULL, term, term->schema, term->schema->nodetype & LYD_NODE_TERM, LY_EINVAL);
@@ -1620,7 +1620,7 @@
return _lyd_change_term(term, val_str, val_str ? strlen(val_str) : 0, LY_VALUE_CANON);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_change_meta(struct lyd_meta *meta, const char *val_str)
{
LY_ERR ret = LY_SUCCESS;
@@ -2049,7 +2049,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_path(struct lyd_node *parent, const struct ly_ctx *ctx, const char *path, const char *value, uint32_t options,
struct lyd_node **node)
{
@@ -2060,7 +2060,7 @@
return lyd_new_path_(parent, ctx, NULL, path, value, 0, LYD_ANYDATA_STRING, options, node, NULL);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_path2(struct lyd_node *parent, const struct ly_ctx *ctx, const char *path, const void *value,
size_t value_len, LYD_ANYDATA_VALUETYPE value_type, uint32_t options, struct lyd_node **new_parent,
struct lyd_node **new_node)
@@ -2072,7 +2072,7 @@
return lyd_new_path_(parent, ctx, NULL, path, value, value_len, value_type, options, new_parent, new_node);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_ext_path(struct lyd_node *parent, const struct lysc_ext_instance *ext, const char *path, const void *value,
uint32_t options, struct lyd_node **node)
{
@@ -2226,7 +2226,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_implicit_tree(struct lyd_node *tree, uint32_t implicit_options, struct lyd_node **diff)
{
LY_ERR ret = LY_SUCCESS;
@@ -2263,7 +2263,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_implicit_all(struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t implicit_options, struct lyd_node **diff)
{
const struct lys_module *mod;
@@ -2303,7 +2303,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_new_implicit_module(struct lyd_node **tree, const struct lys_module *module, uint32_t implicit_options,
struct lyd_node **diff)
{
@@ -2669,7 +2669,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_insert_child(struct lyd_node *parent, struct lyd_node *node)
{
struct lyd_node *iter;
@@ -2697,7 +2697,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_insert_sibling(struct lyd_node *sibling, struct lyd_node *node, struct lyd_node **first)
{
struct lyd_node *iter;
@@ -2741,7 +2741,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_insert_before(struct lyd_node *sibling, struct lyd_node *node)
{
LY_CHECK_ARG_RET(NULL, sibling, node, LY_EINVAL);
@@ -2761,7 +2761,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_insert_after(struct lyd_node *sibling, struct lyd_node *node)
{
LY_CHECK_ARG_RET(NULL, sibling, node, LY_EINVAL);
@@ -2781,7 +2781,7 @@
return LY_SUCCESS;
}
-API void
+LIBYANG_API_DEF void
lyd_unlink_siblings(struct lyd_node *node)
{
struct lyd_node *next, *elem, *first = NULL;
@@ -2792,7 +2792,7 @@
}
}
-API void
+LIBYANG_API_DEF void
lyd_unlink_tree(struct lyd_node *node)
{
struct lyd_node *iter;
@@ -3020,7 +3020,7 @@
return LY_SUCCESS;
}
-API const struct lyd_node_term *
+LIBYANG_API_DEF const struct lyd_node_term *
lyd_target(const struct ly_path *path, const struct lyd_node *tree)
{
struct lyd_node *target;
@@ -3306,13 +3306,13 @@
return LY_EINT;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_compare_single(const struct lyd_node *node1, const struct lyd_node *node2, uint32_t options)
{
return lyd_compare_single_(node1, node2, options, 0);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_compare_siblings(const struct lyd_node *node1, const struct lyd_node *node2, uint32_t options)
{
for ( ; node1 && node2; node1 = node1->next, node2 = node2->next) {
@@ -3325,7 +3325,7 @@
return LY_ENOT;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_compare_meta(const struct lyd_meta *meta1, const struct lyd_meta *meta2)
{
if (!meta1 || !meta2) {
@@ -3659,19 +3659,19 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_dup_single(const struct lyd_node *node, struct lyd_node_inner *parent, uint32_t options, struct lyd_node **dup)
{
return lyd_dup(node, parent, options, 1, dup);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_dup_siblings(const struct lyd_node *node, struct lyd_node_inner *parent, uint32_t options, struct lyd_node **dup)
{
return lyd_dup(node, parent, options, 0, dup);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_dup_meta_single(const struct lyd_meta *meta, struct lyd_node *node, struct lyd_meta **dup)
{
LY_ERR ret = LY_SUCCESS;
@@ -3878,19 +3878,19 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_merge_tree(struct lyd_node **target, const struct lyd_node *source, uint16_t options)
{
return lyd_merge(target, source, NULL, NULL, NULL, options, 1);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_merge_siblings(struct lyd_node **target, const struct lyd_node *source, uint16_t options)
{
return lyd_merge(target, source, NULL, NULL, NULL, options, 0);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_merge_module(struct lyd_node **target, const struct lyd_node *source, const struct lys_module *mod,
lyd_merge_cb merge_cb, void *cb_data, uint16_t options)
{
@@ -4008,7 +4008,7 @@
return rc;
}
-API char *
+LIBYANG_API_DEF char *
lyd_path(const struct lyd_node *node, LYD_PATH_TYPE pathtype, char *buffer, size_t buflen)
{
ly_bool is_static = 0;
@@ -4095,7 +4095,7 @@
return buffer;
}
-API struct lyd_meta *
+LIBYANG_API_DEF struct lyd_meta *
lyd_find_meta(const struct lyd_meta *first, const struct lys_module *module, const char *name)
{
struct lyd_meta *ret = NULL;
@@ -4139,7 +4139,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_find_sibling_first(const struct lyd_node *siblings, const struct lyd_node *target, struct lyd_node **match)
{
struct lyd_node **match_p, *iter;
@@ -4307,7 +4307,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_find_sibling_val(const struct lyd_node *siblings, const struct lysc_node *schema, const char *key_or_value,
size_t val_len, struct lyd_node **match)
{
@@ -4351,7 +4351,7 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_find_sibling_dup_inst_set(const struct lyd_node *siblings, const struct lyd_node *target, struct ly_set **set)
{
struct lyd_node **match_p, *first, *iter;
@@ -4423,7 +4423,7 @@
return LY_EMEM;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_find_sibling_opaq_next(const struct lyd_node *first, const char *name, struct lyd_node **match)
{
LY_CHECK_ARG_RET(NULL, name, LY_EINVAL);
@@ -4440,7 +4440,7 @@
return first ? LY_SUCCESS : LY_ENOTFOUND;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_find_xpath3(const struct lyd_node *ctx_node, const struct lyd_node *tree, const char *xpath,
const struct lyxp_var *vars, struct ly_set **set)
{
@@ -4490,7 +4490,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_find_xpath2(const struct lyd_node *ctx_node, const char *xpath, const struct lyxp_var *vars, struct ly_set **set)
{
LY_CHECK_ARG_RET(NULL, ctx_node, xpath, set, LY_EINVAL);
@@ -4498,7 +4498,7 @@
return lyd_find_xpath3(ctx_node, ctx_node, xpath, vars, set);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_find_xpath(const struct lyd_node *ctx_node, const char *xpath, struct ly_set **set)
{
LY_CHECK_ARG_RET(NULL, ctx_node, xpath, set, LY_EINVAL);
@@ -4506,7 +4506,7 @@
return lyd_find_xpath3(ctx_node, ctx_node, xpath, NULL, set);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_eval_xpath2(const struct lyd_node *ctx_node, const char *xpath, const struct lyxp_var *vars, ly_bool *result)
{
LY_ERR ret = LY_SUCCESS;
@@ -4536,13 +4536,13 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_eval_xpath(const struct lyd_node *ctx_node, const char *xpath, ly_bool *result)
{
return lyd_eval_xpath2(ctx_node, xpath, NULL, result);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_find_path(const struct lyd_node *ctx_node, const char *path, ly_bool output, struct lyd_node **match)
{
LY_ERR ret = LY_SUCCESS;
@@ -4570,7 +4570,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_find_target(const struct ly_path *path, const struct lyd_node *tree, struct lyd_node **match)
{
LY_ERR ret;
@@ -4592,7 +4592,7 @@
return LY_SUCCESS;
}
-API uint32_t
+LIBYANG_API_DEF uint32_t
lyd_list_pos(const struct lyd_node *instance)
{
const struct lyd_node *iter = NULL;
@@ -4614,7 +4614,7 @@
return pos;
}
-API struct lyd_node *
+LIBYANG_API_DEF struct lyd_node *
lyd_first_sibling(const struct lyd_node *node)
{
struct lyd_node *start;
diff --git a/src/tree_data.h b/src/tree_data.h
index a77844b..acbb7c2 100644
--- a/src/tree_data.h
+++ b/src/tree_data.h
@@ -1032,7 +1032,7 @@
* @param[in] node Node to use.
* @return Pointer to the first child node (if any) of the @p node.
*/
-struct lyd_node *lyd_child_no_keys(const struct lyd_node *node);
+LIBYANG_API_DECL struct lyd_node *lyd_child_no_keys(const struct lyd_node *node);
/**
* @brief Get the owner module of the data node. It is the module of the top-level schema node. Generally,
@@ -1043,7 +1043,7 @@
* @param[in] node Data node to examine.
* @return Module owner of the node.
*/
-const struct lys_module *lyd_owner_module(const struct lyd_node *node);
+LIBYANG_API_DECL const struct lys_module *lyd_owner_module(const struct lyd_node *node);
/**
* @brief Check whether a node value equals to its default one.
@@ -1051,7 +1051,7 @@
* @param[in] node Term node to test.
* @return false (no, it is not a default node) or true (yes, it is default)
*/
-ly_bool lyd_is_default(const struct lyd_node *node);
+LIBYANG_API_DECL ly_bool lyd_is_default(const struct lyd_node *node);
/**
* @brief Learn the relative position of a list or leaf-list instance within other instances of the same schema node.
@@ -1060,7 +1060,7 @@
* @return 0 on error.
* @return Positive integer of the @p instance position.
*/
-uint32_t lyd_list_pos(const struct lyd_node *instance);
+LIBYANG_API_DECL uint32_t lyd_list_pos(const struct lyd_node *instance);
/**
* @brief Get the first sibling of the given node.
@@ -1068,7 +1068,7 @@
* @param[in] node Node which first sibling is going to be the result.
* @return The first sibling of the given node or the node itself if it is the first child of the parent.
*/
-struct lyd_node *lyd_first_sibling(const struct lyd_node *node);
+LIBYANG_API_DECL struct lyd_node *lyd_first_sibling(const struct lyd_node *node);
/**
* @brief Learn the length of LYB data.
@@ -1077,7 +1077,7 @@
* @return Length of the LYB data chunk,
* @return -1 on error.
*/
-int lyd_lyb_data_length(const char *data);
+LIBYANG_API_DECL int lyd_lyb_data_length(const char *data);
/**
* @brief Get the (canonical) value of a lyd_value.
@@ -1088,7 +1088,7 @@
* @param[in] value Value structure to use.
* @return Canonical value.
*/
-const char *lyd_value_get_canonical(const struct ly_ctx *ctx, const struct lyd_value *value);
+LIBYANG_API_DECL const char *lyd_value_get_canonical(const struct ly_ctx *ctx, const struct lyd_value *value);
/**
* @brief Get the (canonical) value of a data node.
@@ -1137,7 +1137,7 @@
* @param[out] value_str String representation of the value.
* @return LY_ERR value.
*/
-LY_ERR lyd_any_value_str(const struct lyd_node *any, char **value_str);
+LIBYANG_API_DECL LY_ERR lyd_any_value_str(const struct lyd_node *any, char **value_str);
/**
* @brief Copy anydata value from one node to another. Target value is freed first.
@@ -1147,7 +1147,7 @@
* @param[in] value_type Source value type.
* @return LY_ERR value.
*/
-LY_ERR lyd_any_copy_value(struct lyd_node *trg, const union lyd_any_value *value, LYD_ANYDATA_VALUETYPE value_type);
+LIBYANG_API_DECL LY_ERR lyd_any_copy_value(struct lyd_node *trg, const union lyd_any_value *value, LYD_ANYDATA_VALUETYPE value_type);
/**
* @brief Create a new inner node in the data tree.
@@ -1164,7 +1164,7 @@
* @param[out] node Optional created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_inner(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
+LIBYANG_API_DECL LY_ERR lyd_new_inner(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
struct lyd_node **node);
/**
@@ -1180,7 +1180,7 @@
* @param[out] node The created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_ext_inner(const struct lysc_ext_instance *ext, const char *name, struct lyd_node **node);
+LIBYANG_API_DECL LY_ERR lyd_new_ext_inner(const struct lysc_ext_instance *ext, const char *name, struct lyd_node **node);
/**
* @brief Create a new list node in the data tree.
@@ -1196,7 +1196,7 @@
* key-less lists.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_list(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
+LIBYANG_API_DECL LY_ERR lyd_new_list(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
struct lyd_node **node, ...);
/**
@@ -1212,7 +1212,7 @@
* by its length. No keys are expected for key-less lists.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_list_bin(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
+LIBYANG_API_DECL LY_ERR lyd_new_list_bin(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
struct lyd_node **node, ...);
/**
@@ -1228,7 +1228,7 @@
* key-less lists.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_list_canon(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
+LIBYANG_API_DECL LY_ERR lyd_new_list_canon(struct lyd_node *parent, const struct lys_module *module, const char *name, ly_bool output,
struct lyd_node **node, ...);
/**
@@ -1245,7 +1245,7 @@
* key-less lists.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_ext_list(const struct lysc_ext_instance *ext, const char *name, struct lyd_node **node, ...);
+LIBYANG_API_DECL LY_ERR lyd_new_ext_list(const struct lysc_ext_instance *ext, const char *name, struct lyd_node **node, ...);
/**
* @brief Create a new list node in the data tree.
@@ -1261,7 +1261,7 @@
* @param[out] node Optional created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_list2(struct lyd_node *parent, const struct lys_module *module, const char *name, const char *keys,
+LIBYANG_API_DECL LY_ERR lyd_new_list2(struct lyd_node *parent, const struct lys_module *module, const char *name, const char *keys,
ly_bool output, struct lyd_node **node);
/**
@@ -1278,7 +1278,7 @@
* @param[out] node Optional created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_term(struct lyd_node *parent, const struct lys_module *module, const char *name, const char *val_str,
+LIBYANG_API_DECL LY_ERR lyd_new_term(struct lyd_node *parent, const struct lys_module *module, const char *name, const char *val_str,
ly_bool output, struct lyd_node **node);
/**
@@ -1294,7 +1294,7 @@
* @param[out] node Optional created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_term_bin(struct lyd_node *parent, const struct lys_module *module, const char *name, const void *value,
+LIBYANG_API_DECL LY_ERR lyd_new_term_bin(struct lyd_node *parent, const struct lys_module *module, const char *name, const void *value,
size_t value_len, ly_bool output, struct lyd_node **node);
/**
@@ -1309,7 +1309,7 @@
* @param[out] node Optional created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_term_canon(struct lyd_node *parent, const struct lys_module *module, const char *name,
+LIBYANG_API_DECL LY_ERR lyd_new_term_canon(struct lyd_node *parent, const struct lys_module *module, const char *name,
const char *val_str, ly_bool output, struct lyd_node **node);
/**
@@ -1325,7 +1325,7 @@
* @param[out] node The created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_ext_term(const struct lysc_ext_instance *ext, const char *name, const char *val_str, struct lyd_node **node);
+LIBYANG_API_DECL LY_ERR lyd_new_ext_term(const struct lysc_ext_instance *ext, const char *name, const char *val_str, struct lyd_node **node);
/**
* @brief Create a new any node in the data tree.
@@ -1343,7 +1343,7 @@
* @param[out] node Optional created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_any(struct lyd_node *parent, const struct lys_module *module, const char *name, const void *value,
+LIBYANG_API_DECL LY_ERR lyd_new_any(struct lyd_node *parent, const struct lys_module *module, const char *name, const void *value,
ly_bool use_value, LYD_ANYDATA_VALUETYPE value_type, ly_bool output, struct lyd_node **node);
/**
@@ -1360,7 +1360,7 @@
* @param[out] node The created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_ext_any(const struct lysc_ext_instance *ext, const char *name, const void *value, ly_bool use_value,
+LIBYANG_API_DECL LY_ERR lyd_new_ext_any(const struct lysc_ext_instance *ext, const char *name, const void *value, ly_bool use_value,
LYD_ANYDATA_VALUETYPE value_type, struct lyd_node **node);
/**
@@ -1377,7 +1377,7 @@
* @param[out] meta Optional created metadata. Must be set if @p parent is NULL.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_meta(const struct ly_ctx *ctx, struct lyd_node *parent, const struct lys_module *module, const char *name,
+LIBYANG_API_DECL LY_ERR lyd_new_meta(const struct ly_ctx *ctx, struct lyd_node *parent, const struct lys_module *module, const char *name,
const char *val_str, ly_bool clear_dflt, struct lyd_meta **meta);
/**
@@ -1392,7 +1392,7 @@
* @return LY_ENOT if the attribute could not be parsed into any metadata.
* @return LY_ERR on error.
*/
-LY_ERR lyd_new_meta2(const struct ly_ctx *ctx, struct lyd_node *parent, ly_bool clear_dflt, const struct lyd_attr *attr,
+LIBYANG_API_DECL LY_ERR lyd_new_meta2(const struct ly_ctx *ctx, struct lyd_node *parent, ly_bool clear_dflt, const struct lyd_attr *attr,
struct lyd_meta **meta);
/**
@@ -1407,7 +1407,7 @@
* @param[out] node Optional created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_opaq(struct lyd_node *parent, const struct ly_ctx *ctx, const char *name, const char *value,
+LIBYANG_API_DECL LY_ERR lyd_new_opaq(struct lyd_node *parent, const struct ly_ctx *ctx, const char *name, const char *value,
const char *prefix, const char *module_name, struct lyd_node **node);
/**
@@ -1422,7 +1422,7 @@
* @param[out] node Optional created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_opaq2(struct lyd_node *parent, const struct ly_ctx *ctx, const char *name, const char *value,
+LIBYANG_API_DECL LY_ERR lyd_new_opaq2(struct lyd_node *parent, const struct ly_ctx *ctx, const char *name, const char *value,
const char *prefix, const char *module_ns, struct lyd_node **node);
/**
@@ -1438,7 +1438,7 @@
* @param[out] attr Optional created attribute.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_attr(struct lyd_node *parent, const char *module_name, const char *name, const char *value,
+LIBYANG_API_DECL LY_ERR lyd_new_attr(struct lyd_node *parent, const char *module_name, const char *name, const char *value,
struct lyd_attr **attr);
/**
@@ -1453,7 +1453,7 @@
* @param[out] attr Optional created attribute.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_attr2(struct lyd_node *parent, const char *module_ns, const char *name, const char *value,
+LIBYANG_API_DECL LY_ERR lyd_new_attr2(struct lyd_node *parent, const char *module_ns, const char *name, const char *value,
struct lyd_attr **attr);
/**
@@ -1510,7 +1510,7 @@
* @param[out] node Optional first created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_path(struct lyd_node *parent, const struct ly_ctx *ctx, const char *path, const char *value,
+LIBYANG_API_DECL LY_ERR lyd_new_path(struct lyd_node *parent, const struct ly_ctx *ctx, const char *path, const char *value,
uint32_t options, struct lyd_node **node);
/**
@@ -1533,7 +1533,7 @@
* @param[out] new_node Optional last node created.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_path2(struct lyd_node *parent, const struct ly_ctx *ctx, const char *path, const void *value,
+LIBYANG_API_DECL LY_ERR lyd_new_path2(struct lyd_node *parent, const struct ly_ctx *ctx, const char *path, const void *value,
size_t value_len, LYD_ANYDATA_VALUETYPE value_type, uint32_t options, struct lyd_node **new_parent,
struct lyd_node **new_node);
@@ -1555,7 +1555,7 @@
* @param[out] node Optional first created node.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_ext_path(struct lyd_node *parent, const struct lysc_ext_instance *ext, const char *path, const void *value,
+LIBYANG_API_DECL LY_ERR lyd_new_ext_path(struct lyd_node *parent, const struct lysc_ext_instance *ext, const char *path, const void *value,
uint32_t options, struct lyd_node **node);
/**
@@ -1587,7 +1587,7 @@
* @param[out] diff Optional diff with any created nodes.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_implicit_tree(struct lyd_node *tree, uint32_t implicit_options, struct lyd_node **diff);
+LIBYANG_API_DECL LY_ERR lyd_new_implicit_tree(struct lyd_node *tree, uint32_t implicit_options, struct lyd_node **diff);
/**
* @brief Add any missing implicit nodes. Default nodes with a false "when" are not added.
@@ -1600,7 +1600,7 @@
* @param[out] diff Optional diff with any created nodes.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_implicit_all(struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t implicit_options, struct lyd_node **diff);
+LIBYANG_API_DECL LY_ERR lyd_new_implicit_all(struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t implicit_options, struct lyd_node **diff);
/**
* @brief Add any missing implicit nodes of one module. Default nodes with a false "when" are not added.
@@ -1613,7 +1613,7 @@
* @param[out] diff Optional diff with any created nodes.
* @return LY_ERR value.
*/
-LY_ERR lyd_new_implicit_module(struct lyd_node **tree, const struct lys_module *module, uint32_t implicit_options,
+LIBYANG_API_DECL LY_ERR lyd_new_implicit_module(struct lyd_node **tree, const struct lys_module *module, uint32_t implicit_options,
struct lyd_node **diff);
/**
@@ -1629,7 +1629,7 @@
* @return LY_ENOT if the values were equal and no change occurred,
* @return LY_ERR value on other errors.
*/
-LY_ERR lyd_change_term(struct lyd_node *term, const char *val_str);
+LIBYANG_API_DECL LY_ERR lyd_change_term(struct lyd_node *term, const char *val_str);
/**
* @brief Change the value of a term (leaf or leaf-list) node to a binary value.
@@ -1645,7 +1645,7 @@
* @return LY_ENOT if the values were equal and no change occurred,
* @return LY_ERR value on other errors.
*/
-LY_ERR lyd_change_term_bin(struct lyd_node *term, const void *value, size_t value_len);
+LIBYANG_API_DECL LY_ERR lyd_change_term_bin(struct lyd_node *term, const void *value, size_t value_len);
/**
* @brief Change the value of a term (leaf or leaf-list) node to a canonical string value.
@@ -1661,7 +1661,7 @@
* @return LY_ENOT if the values were equal and no change occurred,
* @return LY_ERR value on other errors.
*/
-LY_ERR lyd_change_term_canon(struct lyd_node *term, const char *val_str);
+LIBYANG_API_DECL LY_ERR lyd_change_term_canon(struct lyd_node *term, const char *val_str);
/**
* @brief Change the value of a metadata instance.
@@ -1672,7 +1672,7 @@
* @return LY_ENOT if the values were equal and no change occurred,
* @return LY_ERR value on other errors.
*/
-LY_ERR lyd_change_meta(struct lyd_meta *meta, const char *val_str);
+LIBYANG_API_DECL LY_ERR lyd_change_meta(struct lyd_meta *meta, const char *val_str);
/**
* @brief Insert a child into a parent.
@@ -1685,7 +1685,7 @@
* @return LY_SUCCESS on success.
* @return LY_ERR error on error.
*/
-LY_ERR lyd_insert_child(struct lyd_node *parent, struct lyd_node *node);
+LIBYANG_API_DECL LY_ERR lyd_insert_child(struct lyd_node *parent, struct lyd_node *node);
/**
* @brief Insert a node into siblings.
@@ -1699,7 +1699,7 @@
* @return LY_SUCCESS on success.
* @return LY_ERR error on error.
*/
-LY_ERR lyd_insert_sibling(struct lyd_node *sibling, struct lyd_node *node, struct lyd_node **first);
+LIBYANG_API_DECL LY_ERR lyd_insert_sibling(struct lyd_node *sibling, struct lyd_node *node, struct lyd_node **first);
/**
* @brief Insert a node before another node, can be used only for user-ordered nodes.
@@ -1712,7 +1712,7 @@
* @return LY_SUCCESS on success.
* @return LY_ERR error on error.
*/
-LY_ERR lyd_insert_before(struct lyd_node *sibling, struct lyd_node *node);
+LIBYANG_API_DECL LY_ERR lyd_insert_before(struct lyd_node *sibling, struct lyd_node *node);
/**
* @brief Insert a node after another node, can be used only for user-ordered nodes.
@@ -1725,56 +1725,56 @@
* @return LY_SUCCESS on success.
* @return LY_ERR error on error.
*/
-LY_ERR lyd_insert_after(struct lyd_node *sibling, struct lyd_node *node);
+LIBYANG_API_DECL LY_ERR lyd_insert_after(struct lyd_node *sibling, struct lyd_node *node);
/**
* @brief Unlink the specified node with all the following siblings.
*
* @param[in] node Data tree node to be unlinked (together with all the children and following siblings).
*/
-void lyd_unlink_siblings(struct lyd_node *node);
+LIBYANG_API_DECL void lyd_unlink_siblings(struct lyd_node *node);
/**
* @brief Unlink the specified data subtree.
*
* @param[in] node Data tree node to be unlinked (together with all the children).
*/
-void lyd_unlink_tree(struct lyd_node *node);
+LIBYANG_API_DECL void lyd_unlink_tree(struct lyd_node *node);
/**
* @brief Free all the nodes (even parents of the node) in the data tree.
*
* @param[in] node Any of the nodes inside the tree.
*/
-void lyd_free_all(struct lyd_node *node);
+LIBYANG_API_DECL void lyd_free_all(struct lyd_node *node);
/**
* @brief Free all the sibling nodes (preceding as well as succeeding).
*
* @param[in] node Any of the sibling nodes to free.
*/
-void lyd_free_siblings(struct lyd_node *node);
+LIBYANG_API_DECL void lyd_free_siblings(struct lyd_node *node);
/**
* @brief Free (and unlink) the specified data (sub)tree.
*
* @param[in] node Root of the (sub)tree to be freed.
*/
-void lyd_free_tree(struct lyd_node *node);
+LIBYANG_API_DECL void lyd_free_tree(struct lyd_node *node);
/**
* @brief Free a single metadata instance.
*
* @param[in] meta Metadata to free.
*/
-void lyd_free_meta_single(struct lyd_meta *meta);
+LIBYANG_API_DECL void lyd_free_meta_single(struct lyd_meta *meta);
/**
* @brief Free the metadata instance with any following instances.
*
* @param[in] meta Metadata to free.
*/
-void lyd_free_meta_siblings(struct lyd_meta *meta);
+LIBYANG_API_DECL void lyd_free_meta_siblings(struct lyd_meta *meta);
/**
* @brief Free a single attribute.
@@ -1782,7 +1782,7 @@
* @param[in] ctx Context where the attributes were created.
* @param[in] attr Attribute to free.
*/
-void lyd_free_attr_single(const struct ly_ctx *ctx, struct lyd_attr *attr);
+LIBYANG_API_DECL void lyd_free_attr_single(const struct ly_ctx *ctx, struct lyd_attr *attr);
/**
* @brief Free the attribute with any following attributes.
@@ -1790,7 +1790,7 @@
* @param[in] ctx Context where the attributes were created.
* @param[in] attr First attribute to free.
*/
-void lyd_free_attr_siblings(const struct ly_ctx *ctx, struct lyd_attr *attr);
+LIBYANG_API_DECL void lyd_free_attr_siblings(const struct ly_ctx *ctx, struct lyd_attr *attr);
/**
* @brief Check type restrictions applicable to the particular leaf/leaf-list with the given string @p value.
@@ -1810,7 +1810,7 @@
* (e.g. due to require-instance).
* @return LY_ERR value if an error occurred.
*/
-LY_ERR lyd_value_validate(const struct ly_ctx *ctx, const struct lysc_node *schema, const char *value, size_t value_len,
+LIBYANG_API_DECL LY_ERR lyd_value_validate(const struct ly_ctx *ctx, const struct lysc_node *schema, const char *value, size_t value_len,
const struct lyd_node *ctx_node, const struct lysc_type **realtype, const char **canonical);
/**
@@ -1825,7 +1825,7 @@
* @return LY_ENOT if the values do not match,
* @return LY_ERR value if an error occurred.
*/
-LY_ERR lyd_value_compare(const struct lyd_node_term *node, const char *value, size_t value_len);
+LIBYANG_API_DECL LY_ERR lyd_value_compare(const struct lyd_node_term *node, const char *value, size_t value_len);
/**
* @ingroup datatree
@@ -1853,7 +1853,7 @@
* @return LY_SUCCESS if the nodes are equivalent.
* @return LY_ENOT if the nodes are not equivalent.
*/
-LY_ERR lyd_compare_single(const struct lyd_node *node1, const struct lyd_node *node2, uint32_t options);
+LIBYANG_API_DECL LY_ERR lyd_compare_single(const struct lyd_node *node1, const struct lyd_node *node2, uint32_t options);
/**
* @brief Compare 2 lists of siblings if they are equivalent.
@@ -1866,7 +1866,7 @@
* @return LY_SUCCESS if all the siblings are equivalent.
* @return LY_ENOT if the siblings are not equivalent.
*/
-LY_ERR lyd_compare_siblings(const struct lyd_node *node1, const struct lyd_node *node2, uint32_t options);
+LIBYANG_API_DECL LY_ERR lyd_compare_siblings(const struct lyd_node *node1, const struct lyd_node *node2, uint32_t options);
/**
* @brief Compare 2 metadata.
@@ -1878,7 +1878,7 @@
* @return LY_SUCCESS if the metadata are equivalent.
* @return LY_ENOT if not.
*/
-LY_ERR lyd_compare_meta(const struct lyd_meta *meta1, const struct lyd_meta *meta2);
+LIBYANG_API_DECL LY_ERR lyd_compare_meta(const struct lyd_meta *meta1, const struct lyd_meta *meta2);
/**
* @ingroup datatree
@@ -1914,7 +1914,7 @@
* node(s) (when LYD_DUP_WITH_PARENTS used), the first duplicated node is still returned.
* @return LY_ERR value.
*/
-LY_ERR lyd_dup_single(const struct lyd_node *node, struct lyd_node_inner *parent, uint32_t options, struct lyd_node **dup);
+LIBYANG_API_DECL LY_ERR lyd_dup_single(const struct lyd_node *node, struct lyd_node_inner *parent, uint32_t options, struct lyd_node **dup);
/**
* @brief Create a copy of the specified data tree \p node with any following siblings. Schema references are kept the same.
@@ -1928,7 +1928,7 @@
* node(s) (when LYD_DUP_WITH_PARENTS used), the first duplicated node is still returned.
* @return LY_ERR value.
*/
-LY_ERR lyd_dup_siblings(const struct lyd_node *node, struct lyd_node_inner *parent, uint32_t options, struct lyd_node **dup);
+LIBYANG_API_DECL LY_ERR lyd_dup_siblings(const struct lyd_node *node, struct lyd_node_inner *parent, uint32_t options, struct lyd_node **dup);
/**
* @brief Create a copy of the metadata.
@@ -1938,7 +1938,7 @@
* @param[out] dup Optional created metadata copy.
* @return LY_ERR value.
*/
-LY_ERR lyd_dup_meta_single(const struct lyd_meta *meta, struct lyd_node *parent, struct lyd_meta **dup);
+LIBYANG_API_DECL LY_ERR lyd_dup_meta_single(const struct lyd_meta *meta, struct lyd_node *parent, struct lyd_meta **dup);
/**
* @ingroup datatree
@@ -1980,7 +1980,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR value on error.
*/
-LY_ERR lyd_merge_tree(struct lyd_node **target, const struct lyd_node *source, uint16_t options);
+LIBYANG_API_DECL LY_ERR lyd_merge_tree(struct lyd_node **target, const struct lyd_node *source, uint16_t options);
/**
* @brief Merge the source data tree with any following siblings into the target data tree. Merge may not be
@@ -2003,7 +2003,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR value on error.
*/
-LY_ERR lyd_merge_siblings(struct lyd_node **target, const struct lyd_node *source, uint16_t options);
+LIBYANG_API_DECL LY_ERR lyd_merge_siblings(struct lyd_node **target, const struct lyd_node *source, uint16_t options);
/**
* @brief Callback for matching merge nodes.
@@ -2031,7 +2031,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR value on error.
*/
-LY_ERR lyd_merge_module(struct lyd_node **target, const struct lyd_node *source, const struct lys_module *mod,
+LIBYANG_API_DECL LY_ERR lyd_merge_module(struct lyd_node **target, const struct lyd_node *source, const struct lys_module *mod,
lyd_merge_cb merge_cb, void *cb_data, uint16_t options);
/**
@@ -2076,7 +2076,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR on error.
*/
-LY_ERR lyd_diff_tree(const struct lyd_node *first, const struct lyd_node *second, uint16_t options, struct lyd_node **diff);
+LIBYANG_API_DECL LY_ERR lyd_diff_tree(const struct lyd_node *first, const struct lyd_node *second, uint16_t options, struct lyd_node **diff);
/**
* @brief Learn the differences between 2 data trees including all the following siblings.
@@ -2090,7 +2090,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR on error.
*/
-LY_ERR lyd_diff_siblings(const struct lyd_node *first, const struct lyd_node *second, uint16_t options, struct lyd_node **diff);
+LIBYANG_API_DECL LY_ERR lyd_diff_siblings(const struct lyd_node *first, const struct lyd_node *second, uint16_t options, struct lyd_node **diff);
/**
* @brief Callback for diff nodes.
@@ -2118,7 +2118,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR on error.
*/
-LY_ERR lyd_diff_apply_module(struct lyd_node **data, const struct lyd_node *diff, const struct lys_module *mod,
+LIBYANG_API_DECL LY_ERR lyd_diff_apply_module(struct lyd_node **data, const struct lyd_node *diff, const struct lys_module *mod,
lyd_diff_cb diff_cb, void *cb_data);
/**
@@ -2131,7 +2131,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR on error.
*/
-LY_ERR lyd_diff_apply_all(struct lyd_node **data, const struct lyd_node *diff);
+LIBYANG_API_DECL LY_ERR lyd_diff_apply_all(struct lyd_node **data, const struct lyd_node *diff);
/**
* @ingroup datatree
@@ -2172,7 +2172,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR on error.
*/
-LY_ERR lyd_diff_merge_module(struct lyd_node **diff, const struct lyd_node *src_diff, const struct lys_module *mod,
+LIBYANG_API_DECL LY_ERR lyd_diff_merge_module(struct lyd_node **diff, const struct lyd_node *src_diff, const struct lys_module *mod,
lyd_diff_cb diff_cb, void *cb_data, uint16_t options);
/**
@@ -2191,7 +2191,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR on error.
*/
-LY_ERR lyd_diff_merge_tree(struct lyd_node **diff_first, struct lyd_node *diff_parent, const struct lyd_node *src_sibling,
+LIBYANG_API_DECL LY_ERR lyd_diff_merge_tree(struct lyd_node **diff_first, struct lyd_node *diff_parent, const struct lyd_node *src_sibling,
lyd_diff_cb diff_cb, void *cb_data, uint16_t options);
/**
@@ -2205,7 +2205,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR on error.
*/
-LY_ERR lyd_diff_merge_all(struct lyd_node **diff, const struct lyd_node *src_diff, uint16_t options);
+LIBYANG_API_DECL LY_ERR lyd_diff_merge_all(struct lyd_node **diff, const struct lyd_node *src_diff, uint16_t options);
/**
* @brief Reverse a diff and make the opposite changes. Meaning change create to delete, delete to create,
@@ -2216,7 +2216,7 @@
* @return LY_SUCCESS on success.
* @return LY_ERR on error.
*/
-LY_ERR lyd_diff_reverse_all(const struct lyd_node *src_diff, struct lyd_node **diff);
+LIBYANG_API_DECL LY_ERR lyd_diff_reverse_all(const struct lyd_node *src_diff, struct lyd_node **diff);
/**
* @brief Deprecated, use ::lyd_find_target() instead.
@@ -2226,7 +2226,7 @@
* @return Found target node,
* @return NULL if not found.
*/
-const struct lyd_node_term *lyd_target(const struct ly_path *path, const struct lyd_node *tree);
+LIBYANG_API_DECL const struct lyd_node_term *lyd_target(const struct ly_path *path, const struct lyd_node *tree);
/**
* @brief Types of the different data paths.
@@ -2249,7 +2249,7 @@
* @return NULL in case of memory allocation error, path of the node otherwise.
* In case the @p buffer is NULL, the returned string is dynamically allocated and caller is responsible to free it.
*/
-char *lyd_path(const struct lyd_node *node, LYD_PATH_TYPE pathtype, char *buffer, size_t buflen);
+LIBYANG_API_DECL char *lyd_path(const struct lyd_node *node, LYD_PATH_TYPE pathtype, char *buffer, size_t buflen);
/**
* @brief Find a specific metadata.
@@ -2260,7 +2260,7 @@
* @return Found metadata,
* @return NULL if not found.
*/
-struct lyd_meta *lyd_find_meta(const struct lyd_meta *first, const struct lys_module *module, const char *name);
+LIBYANG_API_DECL struct lyd_meta *lyd_find_meta(const struct lyd_meta *first, const struct lys_module *module, const char *name);
/**
* @brief Search in the given siblings (NOT recursively) for the first target instance with the same value.
@@ -2273,7 +2273,7 @@
* @return LY_ENOTFOUND if not found, @p match set to NULL.
* @return LY_ERR value if another error occurred.
*/
-LY_ERR lyd_find_sibling_first(const struct lyd_node *siblings, const struct lyd_node *target, struct lyd_node **match);
+LIBYANG_API_DECL LY_ERR lyd_find_sibling_first(const struct lyd_node *siblings, const struct lyd_node *target, struct lyd_node **match);
/**
* @brief Search in the given siblings for the first schema instance.
@@ -2299,7 +2299,7 @@
* @return LY_EINVAL if @p schema is a key-less list.
* @return LY_ERR value if another error occurred.
*/
-LY_ERR lyd_find_sibling_val(const struct lyd_node *siblings, const struct lysc_node *schema, const char *key_or_value,
+LIBYANG_API_DECL LY_ERR lyd_find_sibling_val(const struct lyd_node *siblings, const struct lysc_node *schema, const char *key_or_value,
size_t val_len, struct lyd_node **match);
/**
@@ -2313,7 +2313,7 @@
* @return LY_ENOTFOUND if not found, empty @p set returned.
* @return LY_ERR value if another error occurred.
*/
-LY_ERR lyd_find_sibling_dup_inst_set(const struct lyd_node *siblings, const struct lyd_node *target, struct ly_set **set);
+LIBYANG_API_DECL LY_ERR lyd_find_sibling_dup_inst_set(const struct lyd_node *siblings, const struct lyd_node *target, struct ly_set **set);
/**
* @brief Search the given siblings for an opaque node with a specific name.
@@ -2325,7 +2325,7 @@
* @return LY_ENOTFOUND if not found, @p match set to NULL.
* @return LY_ERR value is an error occurred.
*/
-LY_ERR lyd_find_sibling_opaq_next(const struct lyd_node *first, const char *name, struct lyd_node **match);
+LIBYANG_API_DECL LY_ERR lyd_find_sibling_opaq_next(const struct lyd_node *first, const char *name, struct lyd_node **match);
/**
* @brief Set a new XPath variable to @p vars.
@@ -2338,14 +2338,14 @@
* @param[in] value Value of the variable.
* @return LY_ERR value.
*/
-LY_ERR lyxp_vars_set(struct lyxp_var **vars, const char *name, const char *value);
+LIBYANG_API_DECL LY_ERR lyxp_vars_set(struct lyxp_var **vars, const char *name, const char *value);
/**
* @brief Free the XPath variables.
*
* @param[in] vars [Sized array](@ref sizedarrays) of XPath variables.
*/
-void lyxp_vars_free(struct lyxp_var *vars);
+LIBYANG_API_DECL void lyxp_vars_free(struct lyxp_var *vars);
/**
* @brief Search in the given data for instances of nodes matching the provided XPath.
@@ -2362,7 +2362,7 @@
* @return LY_SUCCESS on success, @p set is returned.
* @return LY_ERR value if an error occurred.
*/
-LY_ERR lyd_find_xpath(const struct lyd_node *ctx_node, const char *xpath, struct ly_set **set);
+LIBYANG_API_DECL LY_ERR lyd_find_xpath(const struct lyd_node *ctx_node, const char *xpath, struct ly_set **set);
/**
* @brief Search in the given data for instances of nodes matching the provided XPath.
@@ -2377,7 +2377,7 @@
* @return LY_SUCCESS on success, @p set is returned.
* @return LY_ERR value if an error occurred.
*/
-LY_ERR lyd_find_xpath2(const struct lyd_node *ctx_node, const char *xpath, const struct lyxp_var *vars,
+LIBYANG_API_DECL LY_ERR lyd_find_xpath2(const struct lyd_node *ctx_node, const char *xpath, const struct lyxp_var *vars,
struct ly_set **set);
/**
@@ -2394,7 +2394,7 @@
* @return LY_SUCCESS on success, @p set is returned.
* @return LY_ERR value if an error occurred.
*/
-LY_ERR lyd_find_xpath3(const struct lyd_node *ctx_node, const struct lyd_node *tree, const char *xpath,
+LIBYANG_API_DECL LY_ERR lyd_find_xpath3(const struct lyd_node *ctx_node, const struct lyd_node *tree, const char *xpath,
const struct lyxp_var *vars, struct ly_set **set);
/**
@@ -2408,7 +2408,7 @@
* @return LY_SUCCESS on success, @p result is returned.
* @return LY_ERR value if an error occurred.
*/
-LY_ERR lyd_eval_xpath(const struct lyd_node *ctx_node, const char *xpath, ly_bool *result);
+LIBYANG_API_DECL LY_ERR lyd_eval_xpath(const struct lyd_node *ctx_node, const char *xpath, ly_bool *result);
/**
* @brief Evaluate an XPath on data and return the result converted to boolean.
@@ -2422,7 +2422,7 @@
* @return LY_SUCCESS on success, @p result is returned.
* @return LY_ERR value if an error occurred.
*/
-LY_ERR lyd_eval_xpath2(const struct lyd_node *ctx_node, const char *xpath,
+LIBYANG_API_DECL LY_ERR lyd_eval_xpath2(const struct lyd_node *ctx_node, const char *xpath,
const struct lyxp_var *vars, ly_bool *result);
/**
@@ -2440,7 +2440,7 @@
* @return LY_ENOTFOUND if no nodes in the path were found.
* @return LY_ERR on other errors.
*/
-LY_ERR lyd_find_path(const struct lyd_node *ctx_node, const char *path, ly_bool output, struct lyd_node **match);
+LIBYANG_API_DECL LY_ERR lyd_find_path(const struct lyd_node *ctx_node, const char *path, ly_bool output, struct lyd_node **match);
/**
* @brief Find the target node of a compiled path (::lyd_value instance-identifier).
@@ -2452,7 +2452,7 @@
* @return LY_ENOTFOUND if no match was found.
* @return LY_ERR on other errors.
*/
-LY_ERR lyd_find_target(const struct ly_path *path, const struct lyd_node *tree, struct lyd_node **match);
+LIBYANG_API_DECL LY_ERR lyd_find_target(const struct ly_path *path, const struct lyd_node *tree, struct lyd_node **match);
/**
* @brief Convert date-and-time from string to UNIX timestamp and fractions of a second.
@@ -2462,7 +2462,7 @@
* @param[out] fractions_s Optional fractions of a second, set to NULL if none.
* @return LY_ERR value.
*/
-LY_ERR ly_time_str2time(const char *value, time_t *time, char **fractions_s);
+LIBYANG_API_DECL LY_ERR ly_time_str2time(const char *value, time_t *time, char **fractions_s);
/**
* @brief Convert UNIX timestamp and fractions of a second into canonical date-and-time string value.
@@ -2472,7 +2472,7 @@
* @param[out] str String date-and-time value in the local timezone.
* @return LY_ERR value.
*/
-LY_ERR ly_time_time2str(time_t time, const char *fractions_s, char **str);
+LIBYANG_API_DECL LY_ERR ly_time_time2str(time_t time, const char *fractions_s, char **str);
/**
* @brief Convert date-and-time from string to timespec.
@@ -2481,7 +2481,7 @@
* @param[out] ts Timespec.
* @return LY_ERR value.
*/
-LY_ERR ly_time_str2ts(const char *value, struct timespec *ts);
+LIBYANG_API_DECL LY_ERR ly_time_str2ts(const char *value, struct timespec *ts);
/**
* @brief Convert timespec into date-and-time string value.
@@ -2490,7 +2490,7 @@
* @param[out] str String date-and-time value in the local timezone.
* @return LY_ERR value.
*/
-LY_ERR ly_time_ts2str(const struct timespec *ts, char **str);
+LIBYANG_API_DECL LY_ERR ly_time_ts2str(const struct timespec *ts, char **str);
#ifdef __cplusplus
}
diff --git a/src/tree_data_free.c b/src/tree_data_free.c
index cf70bf7..88c3b34 100644
--- a/src/tree_data_free.c
+++ b/src/tree_data_free.c
@@ -67,13 +67,13 @@
}
}
-API void
+LIBYANG_API_DEF void
lyd_free_meta_single(struct lyd_meta *meta)
{
lyd_free_meta(meta, 0);
}
-API void
+LIBYANG_API_DEF void
lyd_free_meta_siblings(struct lyd_meta *meta)
{
lyd_free_meta(meta, 1);
@@ -125,13 +125,13 @@
}
}
-API void
+LIBYANG_API_DEF void
lyd_free_attr_single(const struct ly_ctx *ctx, struct lyd_attr *attr)
{
lyd_free_attr(ctx, attr, 0);
}
-API void
+LIBYANG_API_DEF void
lyd_free_attr_siblings(const struct ly_ctx *ctx, struct lyd_attr *attr)
{
lyd_free_attr(ctx, attr, 1);
@@ -194,7 +194,7 @@
free(node);
}
-API void
+LIBYANG_API_DEF void
lyd_free_tree(struct lyd_node *node)
{
if (!node) {
@@ -227,13 +227,13 @@
}
}
-API void
+LIBYANG_API_DEF void
lyd_free_siblings(struct lyd_node *node)
{
lyd_free_(node, 0);
}
-API void
+LIBYANG_API_DEF void
lyd_free_all(struct lyd_node *node)
{
lyd_free_(node, 1);
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index 94b5fd1..84a6a7a 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -164,7 +164,7 @@
}
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyxp_vars_set(struct lyxp_var **vars, const char *name, const char *value)
{
LY_ERR ret = LY_SUCCESS;
@@ -202,7 +202,7 @@
return ret;
}
-API void
+LIBYANG_API_DEF void
lyxp_vars_free(struct lyxp_var *vars)
{
LY_ARRAY_COUNT_TYPE u;
@@ -219,7 +219,7 @@
LY_ARRAY_FREE(vars);
}
-API struct lyd_node *
+LIBYANG_API_DEF struct lyd_node *
lyd_child_no_keys(const struct lyd_node *node)
{
struct lyd_node **children;
@@ -245,7 +245,7 @@
}
}
-API const struct lys_module *
+LIBYANG_API_DEF const struct lys_module *
lyd_owner_module(const struct lyd_node *node)
{
const struct lyd_node_opaq *opaq;
@@ -434,7 +434,7 @@
}
}
-API const char *
+LIBYANG_API_DEF const char *
lyd_value_get_canonical(const struct ly_ctx *ctx, const struct lyd_value *value)
{
LY_CHECK_ARG_RET(ctx, ctx, value, NULL);
@@ -443,7 +443,7 @@
(const char *)value->realtype->plugin->print(ctx, value, LY_VALUE_CANON, NULL, NULL, NULL);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_any_value_str(const struct lyd_node *any, char **value_str)
{
const struct lyd_node_any *a;
@@ -500,7 +500,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_any_copy_value(struct lyd_node *trg, const union lyd_any_value *value, LYD_ANYDATA_VALUETYPE value_type)
{
struct lyd_node_any *t;
@@ -854,7 +854,7 @@
return NULL;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_time_str2time(const char *value, time_t *time, char **fractions_s)
{
struct tm tm = {0};
@@ -917,7 +917,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_time_time2str(time_t time, const char *fractions_s, char **str)
{
struct tm tm;
@@ -962,7 +962,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_time_str2ts(const char *value, struct timespec *ts)
{
LY_ERR rc;
@@ -991,7 +991,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
ly_time_ts2str(const struct timespec *ts, char **str)
{
char frac_buf[10];
diff --git a/src/tree_schema.c b/src/tree_schema.c
index b4d8eaa..076fa37 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -127,7 +127,7 @@
[LY_STMT_YIN_ELEMENT] = {"yin-element", "value", STMT_FLAG_ID},
};
-API const char *
+LIBYANG_API_DEF const char *
ly_stmt2str(enum ly_stmt stmt)
{
if (stmt == LY_STMT_EXTENSION_INSTANCE) {
@@ -144,7 +144,7 @@
[LYS_DEV_REPLACE] = "replace",
};
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lysc_tree_dfs_full(const struct lysc_node *root, lysc_dfs_clb dfs_clb, void *data)
{
struct lysc_node *elem, *elem2;
@@ -181,7 +181,7 @@
return LY_SUCCESS;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lysc_module_dfs_full(const struct lys_module *mod, lysc_dfs_clb dfs_clb, void *data)
{
const struct lysc_node *root;
@@ -396,13 +396,13 @@
return next;
}
-API const struct lysc_node *
+LIBYANG_API_DEF const struct lysc_node *
lys_getnext(const struct lysc_node *last, const struct lysc_node *parent, const struct lysc_module *module, uint32_t options)
{
return lys_getnext_(last, parent, module, NULL, options);
}
-API const struct lysc_node *
+LIBYANG_API_DEF const struct lysc_node *
lys_getnext_ext(const struct lysc_node *last, const struct lysc_node *parent, const struct lysc_ext_instance *ext, uint32_t options)
{
return lys_getnext_(last, parent, NULL, ext, options);
@@ -441,7 +441,7 @@
return NULL;
}
-API const struct lysc_node *
+LIBYANG_API_DEF const struct lysc_node *
lys_find_child(const struct lysc_node *parent, const struct lys_module *module, const char *name, size_t name_len,
uint16_t nodetype, uint32_t options)
{
@@ -474,7 +474,7 @@
return NULL;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_find_xpath_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath, uint32_t options,
struct ly_set **set)
{
@@ -524,7 +524,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_find_expr_atoms(const struct lysc_node *ctx_node, const struct lys_module *cur_mod, const struct lyxp_expr *expr,
const struct lysc_prefix *prefixes, uint32_t options, struct ly_set **set)
{
@@ -570,7 +570,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_find_xpath(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath, uint32_t options,
struct ly_set **set)
{
@@ -622,7 +622,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_find_lypath_atoms(const struct ly_path *path, struct ly_set **set)
{
LY_ERR ret = LY_SUCCESS;
@@ -652,7 +652,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_find_path_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *path, ly_bool output,
struct ly_set **set)
{
@@ -686,7 +686,7 @@
return ret;
}
-API const struct lysc_node *
+LIBYANG_API_DEF const struct lysc_node *
lys_find_path(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *path, ly_bool output)
{
const struct lysc_node *snode = NULL;
@@ -803,7 +803,7 @@
}
}
-API char *
+LIBYANG_API_DEF char *
lysc_path(const struct lysc_node *node, LYSC_PATH_TYPE pathtype, char *buffer, size_t buflen)
{
return lysc_path_until(node, NULL, pathtype, buffer, buflen);
@@ -1177,7 +1177,7 @@
assert(!unres->ds_unres.disabled.count);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_set_implemented(struct lys_module *mod, const char **features)
{
LY_ERR ret = LY_SUCCESS;
@@ -1753,7 +1753,7 @@
return format;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_parse(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, const char **features, struct lys_module **module)
{
LY_ERR ret = LY_SUCCESS;
@@ -1799,7 +1799,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_parse_mem(struct ly_ctx *ctx, const char *data, LYS_INFORMAT format, struct lys_module **module)
{
LY_ERR ret;
@@ -1815,7 +1815,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_parse_fd(struct ly_ctx *ctx, int fd, LYS_INFORMAT format, struct lys_module **module)
{
LY_ERR ret;
@@ -1831,7 +1831,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_parse_path(struct ly_ctx *ctx, const char *path, LYS_INFORMAT format, struct lys_module **module)
{
LY_ERR ret;
@@ -1848,7 +1848,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lys_search_localfile(const char * const *searchpaths, ly_bool cwd, const char *name, const char *revision,
char **localfile, LYS_INFORMAT *format)
{
diff --git a/src/tree_schema.h b/src/tree_schema.h
index e02baeb..95ccfe8 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -433,14 +433,14 @@
* @param[in] stmt The statement identifier to stringify.
* @return Constant string representation of the given @p stmt.
*/
-const char *ly_stmt2str(enum ly_stmt stmt);
+LIBYANG_API_DECL const char *ly_stmt2str(enum ly_stmt stmt);
/**
* @brief Convert nodetype to statement identifier
* @param[in] nodetype Nodetype to convert.
* @return Statement identifier representing the given @p nodetype.
*/
-enum ly_stmt lys_nodetype2stmt(uint16_t nodetype);
+LIBYANG_API_DECL enum ly_stmt lys_nodetype2stmt(uint16_t nodetype);
/**
* @brief Possible cardinalities of the YANG statements.
@@ -2018,7 +2018,7 @@
* @param[in] node Schema node to examine.
* @return When condition associated with the node data instance, NULL if there is none.
*/
-const struct lysc_when *lysc_has_when(const struct lysc_node *node);
+LIBYANG_API_DECL const struct lysc_when *lysc_has_when(const struct lysc_node *node);
/**
* @brief Get the owner module of the schema node. It is the module of the top-level node. Generally,
@@ -2027,7 +2027,7 @@
* @param[in] node Schema node to examine.
* @return Module owner of the node.
*/
-const struct lys_module *lysc_owner_module(const struct lysc_node *node);
+LIBYANG_API_DECL const struct lys_module *lysc_owner_module(const struct lysc_node *node);
/**
* @brief Get the groupings linked list of the given (parsed) schema node.
@@ -2035,7 +2035,7 @@
* @param[in] node Node to examine.
* @return The node's groupings linked list if any, NULL otherwise.
*/
-const struct lysp_node_grp *lysp_node_groupings(const struct lysp_node *node);
+LIBYANG_API_DECL const struct lysp_node_grp *lysp_node_groupings(const struct lysp_node *node);
/**
* @brief Get the typedefs sized array of the given (parsed) schema node.
@@ -2043,7 +2043,7 @@
* @param[in] node Node to examine.
* @return The node's typedefs sized array if any, NULL otherwise.
*/
-const struct lysp_tpdf *lysp_node_typedefs(const struct lysp_node *node);
+LIBYANG_API_DECL const struct lysp_tpdf *lysp_node_typedefs(const struct lysp_node *node);
/**
* @brief Get the actions/RPCs linked list of the given (parsed) schema node.
@@ -2051,7 +2051,7 @@
* @param[in] node Node to examine.
* @return The node's actions/RPCs linked list if any, NULL otherwise.
*/
-const struct lysp_node_action *lysp_node_actions(const struct lysp_node *node);
+LIBYANG_API_DECL const struct lysp_node_action *lysp_node_actions(const struct lysp_node *node);
/**
* @brief Get the Notifications linked list of the given (parsed) schema node.
@@ -2059,7 +2059,7 @@
* @param[in] node Node to examine.
* @return The node's Notifications linked list if any, NULL otherwise.
*/
-const struct lysp_node_notif *lysp_node_notifs(const struct lysp_node *node);
+LIBYANG_API_DECL const struct lysp_node_notif *lysp_node_notifs(const struct lysp_node *node);
/**
* @brief Get the children linked list of the given (parsed) schema node.
@@ -2067,7 +2067,7 @@
* @param[in] node Node to examine.
* @return The node's children linked list if any, NULL otherwise.
*/
-const struct lysp_node *lysp_node_child(const struct lysp_node *node);
+LIBYANG_API_DECL const struct lysp_node *lysp_node_child(const struct lysp_node *node);
/**
* @brief Get the actions/RPCs linked list of the given (compiled) schema node.
@@ -2075,7 +2075,7 @@
* @param[in] node Node to examine.
* @return The node's actions/RPCs linked list if any, NULL otherwise.
*/
-const struct lysc_node_action *lysc_node_actions(const struct lysc_node *node);
+LIBYANG_API_DECL const struct lysc_node_action *lysc_node_actions(const struct lysc_node *node);
/**
* @brief Get the Notifications linked list of the given (compiled) schema node.
@@ -2083,7 +2083,7 @@
* @param[in] node Node to examine.
* @return The node's Notifications linked list if any, NULL otherwise.
*/
-const struct lysc_node_notif *lysc_node_notifs(const struct lysc_node *node);
+LIBYANG_API_DECL const struct lysc_node_notif *lysc_node_notifs(const struct lysc_node *node);
/**
* @brief Get the children linked list of the given (compiled) schema node.
@@ -2095,7 +2095,7 @@
* @return Children linked list if any,
* @return NULL otherwise.
*/
-const struct lysc_node *lysc_node_child(const struct lysc_node *node);
+LIBYANG_API_DECL const struct lysc_node *lysc_node_child(const struct lysc_node *node);
/**
* @brief Get the must statements list if present in the @p node
@@ -2104,7 +2104,7 @@
* @return Pointer to the list of must restrictions ([sized array](@ref sizedarrays))
* @return NULL if there is no must statement in the node, no matter if it is not even allowed or just present
*/
-struct lysc_must *lysc_node_musts(const struct lysc_node *node);
+LIBYANG_API_DECL struct lysc_must *lysc_node_musts(const struct lysc_node *node);
/**
* @brief Get the when statements list if present in the @p node
@@ -2113,7 +2113,7 @@
* @return Pointer to the list of pointers to when statements ([sized array](@ref sizedarrays))
* @return NULL if there is no when statement in the node, no matter if it is not even allowed or just present
*/
-struct lysc_when **lysc_node_when(const struct lysc_node *node);
+LIBYANG_API_DECL struct lysc_when **lysc_node_when(const struct lysc_node *node);
/**
* @brief Callback to be called for every schema node in a DFS traversal.
@@ -2142,7 +2142,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR value returned by @p dfs_clb.
*/
-LY_ERR lysc_tree_dfs_full(const struct lysc_node *root, lysc_dfs_clb dfs_clb, void *data);
+LIBYANG_API_DECL LY_ERR lysc_tree_dfs_full(const struct lysc_node *root, lysc_dfs_clb dfs_clb, void *data);
/**
* @brief DFS traversal of all the schema nodes in a module including RPCs and notifications.
@@ -2155,7 +2155,7 @@
* @return LY_SUCCESS on success,
* @return LY_ERR value returned by @p dfs_clb.
*/
-LY_ERR lysc_module_dfs_full(const struct lys_module *mod, lysc_dfs_clb dfs_clb, void *data);
+LIBYANG_API_DECL LY_ERR lysc_module_dfs_full(const struct lys_module *mod, lysc_dfs_clb dfs_clb, void *data);
/**
* @brief Get how the if-feature statement currently evaluates.
@@ -2165,7 +2165,7 @@
* @return LY_ENOT if it evaluates to false,
* @return LY_ERR on error.
*/
-LY_ERR lysc_iffeature_value(const struct lysc_iffeature *iff);
+LIBYANG_API_DECL LY_ERR lysc_iffeature_value(const struct lysc_iffeature *iff);
/**
* @brief Get how the if-feature statement is evaluated for certain identity.
@@ -2178,7 +2178,7 @@
* @return LY_ENOT if it evaluates to false,
* @return LY_ERR on error.
*/
-LY_ERR lys_identity_iffeature_value(const struct lysc_ident *ident);
+LIBYANG_API_DECL LY_ERR lys_identity_iffeature_value(const struct lysc_ident *ident);
/**
* @brief Get the next feature in the module or submodules.
@@ -2188,7 +2188,7 @@
* @param[in,out] idx Submodule index, set to 0 on first call.
* @return Next found feature, NULL if the last has already been returned.
*/
-struct lysp_feature *lysp_feature_next(const struct lysp_feature *last, const struct lysp_module *pmod, uint32_t *idx);
+LIBYANG_API_DECL struct lysp_feature *lysp_feature_next(const struct lysp_feature *last, const struct lysp_module *pmod, uint32_t *idx);
/**
* @brief Get pointer to the storage of the specified substatement in the given extension instance.
@@ -2206,7 +2206,7 @@
* @return LY_SUCCESS if the @p substmt found.
* @return LY_ENOT in case the @p ext is not able to store (does not allow) the specified @p substmt.
*/
-LY_ERR lysc_ext_substmt(const struct lysc_ext_instance *ext, enum ly_stmt substmt,
+LIBYANG_API_DECL LY_ERR lysc_ext_substmt(const struct lysc_ext_instance *ext, enum ly_stmt substmt,
void **instance_p, enum ly_stmt_cardinality *cardinality_p);
/**
@@ -2231,7 +2231,7 @@
* @return LY_SUCCESS on success, @p set is returned.
* @return LY_ERR value on error.
*/
-LY_ERR lys_find_xpath_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath,
+LIBYANG_API_DECL LY_ERR lys_find_xpath_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath,
uint32_t options, struct ly_set **set);
/**
@@ -2246,7 +2246,7 @@
* @return LY_SUCCESS on success, @p set is returned.
* @return LY_ERR value on error.
*/
-LY_ERR lys_find_expr_atoms(const struct lysc_node *ctx_node, const struct lys_module *cur_mod,
+LIBYANG_API_DECL LY_ERR lys_find_expr_atoms(const struct lysc_node *ctx_node, const struct lys_module *cur_mod,
const struct lyxp_expr *expr, const struct lysc_prefix *prefixes, uint32_t options, struct ly_set **set);
/**
@@ -2260,7 +2260,7 @@
* @return LY_SUCCESS on success, @p set is returned.
* @return LY_ERR value if an error occurred.
*/
-LY_ERR lys_find_xpath(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath, uint32_t options,
+LIBYANG_API_DECL LY_ERR lys_find_xpath(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath, uint32_t options,
struct ly_set **set);
/**
@@ -2271,7 +2271,7 @@
* @return LY_SUCCESS on success, @p set is returned.
* @return LY_ERR value on error.
*/
-LY_ERR lys_find_lypath_atoms(const struct ly_path *path, struct ly_set **set);
+LIBYANG_API_DECL LY_ERR lys_find_lypath_atoms(const struct ly_path *path, struct ly_set **set);
/**
* @brief Get all the schema nodes that are required for @p path to be evaluated (atoms).
@@ -2283,7 +2283,7 @@
* @param[out] set Set of found atoms (schema nodes).
* @return LY_ERR value on error.
*/
-LY_ERR lys_find_path_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *path, ly_bool output,
+LIBYANG_API_DECL LY_ERR lys_find_path_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *path, ly_bool output,
struct ly_set **set);
/**
@@ -2295,7 +2295,7 @@
* @param[in] output Search operation output instead of input.
* @return Found schema node or NULL.
*/
-const struct lysc_node *lys_find_path(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *path,
+LIBYANG_API_DECL const struct lysc_node *lys_find_path(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *path,
ly_bool output);
/**
@@ -2317,7 +2317,7 @@
* @return NULL in case of memory allocation error, path of the node otherwise.
* In case the @p buffer is NULL, the returned string is dynamically allocated and caller is responsible to free it.
*/
-char *lysc_path(const struct lysc_node *node, LYSC_PATH_TYPE pathtype, char *buffer, size_t buflen);
+LIBYANG_API_DECL char *lysc_path(const struct lysc_node *node, LYSC_PATH_TYPE pathtype, char *buffer, size_t buflen);
/**
* @brief Available YANG schema tree structures representing YANG module.
@@ -2380,7 +2380,7 @@
* @return LY_ENOT if the feature is disabled,
* @return LY_ENOTFOUND if the feature was not found.
*/
-LY_ERR lys_feature_value(const struct lys_module *module, const char *feature);
+LIBYANG_API_DECL LY_ERR lys_feature_value(const struct lys_module *module, const char *feature);
/**
* @brief Get next schema tree (sibling) node element that can be instantiated in a data tree. Returned node can
@@ -2402,7 +2402,7 @@
* @param[in] options [ORed options](@ref sgetnextflags).
* @return Next schema tree node that can be instantiated in a data tree, NULL in case there is no such element.
*/
-const struct lysc_node *lys_getnext(const struct lysc_node *last, const struct lysc_node *parent,
+LIBYANG_API_DECL const struct lysc_node *lys_getnext(const struct lysc_node *last, const struct lysc_node *parent,
const struct lysc_module *module, uint32_t options);
/**
@@ -2428,7 +2428,7 @@
* @param[in] options [ORed options](@ref sgetnextflags).
* @return Next schema tree node that can be instantiated in a data tree, NULL in case there is no such element.
*/
-const struct lysc_node *lys_getnext_ext(const struct lysc_node *last, const struct lysc_node *parent,
+LIBYANG_API_DECL const struct lysc_node *lys_getnext_ext(const struct lysc_node *last, const struct lysc_node *parent,
const struct lysc_ext_instance *ext, uint32_t options);
/**
@@ -2458,7 +2458,7 @@
* @param[in] options [ORed options](@ref sgetnextflags).
* @return Found node if any.
*/
-const struct lysc_node *lys_find_child(const struct lysc_node *parent, const struct lys_module *module,
+LIBYANG_API_DECL const struct lysc_node *lys_find_child(const struct lysc_node *parent, const struct lys_module *module,
const char *name, size_t name_len, uint16_t nodetype, uint32_t options);
/**
@@ -2476,7 +2476,7 @@
* @return LY_EDENIED in case the context contains some other revision of the same module which is already implemented.
* @return LY_ERR on other errors during module compilation.
*/
-LY_ERR lys_set_implemented(struct lys_module *mod, const char **features);
+LIBYANG_API_DECL LY_ERR lys_set_implemented(struct lys_module *mod, const char **features);
/**
* @brief Stringify schema nodetype.
@@ -2484,7 +2484,7 @@
* @param[in] nodetype Nodetype to stringify.
* @return Constant string with the name of the node's type.
*/
-const char *lys_nodetype2str(uint16_t nodetype);
+LIBYANG_API_DECL const char *lys_nodetype2str(uint16_t nodetype);
/**
* @brief Getter for original XPath expression from a parsed expression.
@@ -2492,7 +2492,7 @@
* @param[in] path Parsed expression.
* @return Original string expression.
*/
-const char *lyxp_get_expr(const struct lyxp_expr *path);
+LIBYANG_API_DECL const char *lyxp_get_expr(const struct lyxp_expr *path);
/** @} schematree */
diff --git a/src/tree_schema_free.c b/src/tree_schema_free.c
index eb3c563..fdb0bd5 100644
--- a/src/tree_schema_free.c
+++ b/src/tree_schema_free.c
@@ -1041,7 +1041,7 @@
free(module);
}
-API void
+LIBYANG_API_DEF void
lyplg_ext_instance_substatements_free(struct ly_ctx *ctx, struct lysc_ext_substmt *substmts)
{
LY_ARRAY_COUNT_TYPE u;
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index b6e3b7a..6340e1c 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -1246,7 +1246,7 @@
return LY_SUCCESS;
}
-API const struct lysc_when *
+LIBYANG_API_DEF const struct lysc_when *
lysc_has_when(const struct lysc_node *node)
{
struct lysc_when **when;
@@ -1266,7 +1266,7 @@
return NULL;
}
-API const struct lys_module *
+LIBYANG_API_DEF const struct lys_module *
lysc_owner_module(const struct lysc_node *node)
{
if (!node) {
@@ -1277,7 +1277,7 @@
return node->module;
}
-API const char *
+LIBYANG_API_DEF const char *
lys_nodetype2str(uint16_t nodetype)
{
switch (nodetype) {
@@ -1310,7 +1310,7 @@
}
}
-API enum ly_stmt
+LIBYANG_API_DEF enum ly_stmt
lys_nodetype2stmt(uint16_t nodetype)
{
switch (nodetype) {
@@ -1394,7 +1394,7 @@
}
}
-API const struct lysp_tpdf *
+LIBYANG_API_DEF const struct lysp_tpdf *
lysp_node_typedefs(const struct lysp_node *node)
{
switch (node->nodetype) {
@@ -1417,7 +1417,7 @@
}
}
-API const struct lysp_node_grp *
+LIBYANG_API_DEF const struct lysp_node_grp *
lysp_node_groupings(const struct lysp_node *node)
{
switch (node->nodetype) {
@@ -1459,7 +1459,7 @@
}
}
-API const struct lysp_node_action *
+LIBYANG_API_DEF const struct lysp_node_action *
lysp_node_actions(const struct lysp_node *node)
{
struct lysp_node_action **actions;
@@ -1490,7 +1490,7 @@
}
}
-API const struct lysp_node_notif *
+LIBYANG_API_DEF const struct lysp_node_notif *
lysp_node_notifs(const struct lysp_node *node)
{
struct lysp_node_notif **notifs;
@@ -1530,7 +1530,7 @@
}
}
-API const struct lysp_node *
+LIBYANG_API_DEF const struct lysp_node *
lysp_node_child(const struct lysp_node *node)
{
struct lysp_node **child;
@@ -1648,7 +1648,7 @@
}
}
-API const struct lysc_node_action *
+LIBYANG_API_DEF const struct lysc_node_action *
lysc_node_actions(const struct lysc_node *node)
{
struct lysc_node_action **actions;
@@ -1675,7 +1675,7 @@
}
}
-API const struct lysc_node_notif *
+LIBYANG_API_DEF const struct lysc_node_notif *
lysc_node_notifs(const struct lysc_node *node)
{
struct lysc_node_notif **notifs;
@@ -1712,7 +1712,7 @@
}
}
-API const struct lysc_node *
+LIBYANG_API_DEF const struct lysc_node *
lysc_node_child(const struct lysc_node *node)
{
struct lysc_node **child;
@@ -1762,7 +1762,7 @@
}
}
-API struct lysc_must *
+LIBYANG_API_DEF struct lysc_must *
lysc_node_musts(const struct lysc_node *node)
{
struct lysc_must **must_p;
@@ -1808,7 +1808,7 @@
}
}
-API struct lysc_when **
+LIBYANG_API_DEF struct lysc_when **
lysc_node_when(const struct lysc_node *node)
{
struct lysc_when ***when_p;
diff --git a/src/validation.c b/src/validation.c
index 9e365b6..b2b05bb 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -1601,7 +1601,7 @@
return ret;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_validate_all(struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t val_opts, struct lyd_node **diff)
{
LY_CHECK_ARG_RET(NULL, tree, *tree || ctx, LY_EINVAL);
@@ -1616,7 +1616,7 @@
return lyd_validate(tree, NULL, ctx, val_opts, 1, NULL, NULL, NULL, NULL, diff);
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_validate_module(struct lyd_node **tree, const struct lys_module *module, uint32_t val_opts, struct lyd_node **diff)
{
LY_CHECK_ARG_RET(NULL, tree, *tree || module, LY_EINVAL);
@@ -1785,7 +1785,7 @@
return rc;
}
-API LY_ERR
+LIBYANG_API_DEF LY_ERR
lyd_validate_op(struct lyd_node *op_tree, const struct lyd_node *dep_tree, enum lyd_type data_type, struct lyd_node **diff)
{
struct lyd_node *op_node;
diff --git a/src/xpath.c b/src/xpath.c
index f59cfe8..6001949 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -9008,7 +9008,7 @@
return ret;
}
-API const char *
+LIBYANG_API_DEF const char *
lyxp_get_expr(const struct lyxp_expr *path)
{
if (!path) {