From 166a478e6affbf29847409ec926ba3da0b43d030 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Tue, 12 May 2026 16:42:33 -0400 Subject: [PATCH] Add AKERR_EOF, properly call akerr_init_errno --- CMakeLists.txt | 2 +- include/akerror.tmpl.h | 3 ++- src/error.c | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e1e40c8..8c39ecd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ set_source_files_properties(src/errno.c PROPERTIES GENERATED TRUE) add_custom_target(generrno DEPENDS src/errno.c) find_package(PkgConfig REQUIRED) -add_library(akerror STATIC +add_library(akerror SHARED src/error.c src/errno.c ) diff --git a/include/akerror.tmpl.h b/include/akerror.tmpl.h index 8c69f09..6277278 100644 --- a/include/akerror.tmpl.h +++ b/include/akerror.tmpl.h @@ -30,9 +30,10 @@ #define AKERR_VALUE (AKERR_LAST_ERRNO_VALUE + 12) #define AKERR_BEHAVIOR (AKERR_LAST_ERRNO_VALUE + 13) #define AKERR_RELATIONSHIP (AKERR_LAST_ERRNO_VALUE + 14) +#define AKERR_EOF (AKERR_LAST_ERRNO_VALUE + 15) #ifndef AKERR_MAX_ERR_VALUE -#define AKERR_MAX_ERR_VALUE (AKERR_LAST_ERRNO_VALUE + 14) +#define AKERR_MAX_ERR_VALUE (AKERR_LAST_ERRNO_VALUE + 15) #elif AKERR_MAX_ERR_VALUE < 256 #error user-defined AKERR_MAX_ERR_VALUE must be >= 256 #endif diff --git a/src/error.c b/src/error.c index 0837030..c853bda 100644 --- a/src/error.c +++ b/src/error.c @@ -65,7 +65,9 @@ void akerr_init() akerr_name_for_status(AKERR_VALUE, "Value Error"); akerr_name_for_status(AKERR_BEHAVIOR, "Behavior Error"); akerr_name_for_status(AKERR_RELATIONSHIP, "Relationship Error"); - +#if (defined(AKERR_USE_STDLIB) && AKERR_USE_STDLIB == 1) || (!defined(AKERR_USE_STDLIB)) + akerr_init_errno(); +#endif inited = 1; } }