From 63250c91b4d8e3f827b27c604ccec41e44003325 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 22 Dec 2008 17:59:14 +0000 Subject: [PATCH] macros to export symbols git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10910 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/esl/esl.2008.vcproj | 4 +- libs/esl/src/esl.c | 32 ++++++++-------- libs/esl/src/esl_config.c | 8 ++-- libs/esl/src/esl_event.c | 30 ++++++++------- libs/esl/src/esl_threadmutex.c | 12 +++--- libs/esl/src/include/esl.h | 53 ++++++++++++++++---------- libs/esl/src/include/esl_config.h | 8 ++-- libs/esl/src/include/esl_event.h | 28 +++++++------- libs/esl/src/include/esl_threadmutex.h | 12 +++--- 9 files changed, 100 insertions(+), 87 deletions(-) diff --git a/libs/esl/esl.2008.vcproj b/libs/esl/esl.2008.vcproj index c58edf5d36..c4a78e459b 100644 --- a/libs/esl/esl.2008.vcproj +++ b/libs/esl/esl.2008.vcproj @@ -42,7 +42,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="src/include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;ESL_EXPORTS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -120,7 +120,7 @@ 255) return(c); @@ -126,7 +126,7 @@ const short _esl_C_tolower_[1 + ESL_CTYPE_NUM_CHARS] = { const short *_esl_tolower_tab_ = _esl_C_tolower_; -int esl_tolower(int c) +ESL_DECLARE(int) esl_tolower(int c) { if ((unsigned int)c > 255) return(c); @@ -135,7 +135,7 @@ int esl_tolower(int c) return((_esl_tolower_tab_ + 1)[c]); } -const char *esl_stristr(const char *instr, const char *str) +ESL_DECLARE(const char *)esl_stristr(const char *instr, const char *str) { /* ** Rev History: 16/07/97 Greg Thayer Optimized @@ -181,7 +181,7 @@ const char *esl_stristr(const char *instr, const char *str) #endif #endif -int esl_snprintf(char *buffer, size_t count, const char *fmt, ...) +ESL_DECLARE(int) esl_snprintf(char *buffer, size_t count, const char *fmt, ...) { va_list ap; int ret; @@ -280,7 +280,7 @@ void esl_global_set_default_logger(int level) esl_log_level = level; } -size_t esl_url_encode(const char *url, char *buf, size_t len) +ESL_DECLARE(size_t) esl_url_encode(const char *url, char *buf, size_t len) { const char *p; size_t x = 0; @@ -317,7 +317,7 @@ size_t esl_url_encode(const char *url, char *buf, size_t len) return x; } -char *esl_url_decode(char *s) +ESL_DECLARE(char *)esl_url_decode(char *s) { char *o; unsigned int tmp; @@ -334,7 +334,7 @@ char *esl_url_decode(char *s) return s; } -esl_status_t esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in addr) +ESL_DECLARE(esl_status_t) esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in addr) { handle->sock = socket; handle->addr = addr; @@ -364,7 +364,7 @@ esl_status_t esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct return ESL_FAIL; } -esl_status_t esl_sendevent(esl_handle_t *handle, esl_event_t *event) +ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event) { char *txt; @@ -383,7 +383,7 @@ esl_status_t esl_sendevent(esl_handle_t *handle, esl_event_t *event) return ESL_SUCCESS; } -esl_status_t esl_execute(esl_handle_t *handle, const char *app, const char *arg, const char *uuid) +ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, const char *arg, const char *uuid) { char cmd_buf[128] = "sendmsg"; char app_buf[512] = ""; @@ -418,7 +418,7 @@ static int esl_socket_reuseaddr(esl_socket_t socket) #endif } -esl_status_t esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback) +ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback) { esl_socket_t server_sock = ESL_SOCK_INVALID; struct sockaddr_in addr; @@ -475,7 +475,7 @@ esl_status_t esl_listen(const char *host, esl_port_t port, esl_listen_callback_t } -esl_status_t esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password) +ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password) { struct hostent *result; @@ -560,7 +560,7 @@ esl_status_t esl_connect(esl_handle_t *handle, const char *host, esl_port_t port return ESL_FAIL; } -esl_status_t esl_disconnect(esl_handle_t *handle) +ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle) { esl_event_safe_destroy(&handle->last_event); esl_event_safe_destroy(&handle->last_sr_event); @@ -582,7 +582,7 @@ esl_status_t esl_disconnect(esl_handle_t *handle) return ESL_FAIL; } -esl_status_t esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t **save_event) +ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t **save_event) { fd_set rfds, efds; struct timeval tv = { 0 }; @@ -631,7 +631,7 @@ esl_status_t esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t } -esl_status_t esl_recv_event(esl_handle_t *handle, esl_event_t **save_event) +ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, esl_event_t **save_event) { char *c; esl_ssize_t rrval; @@ -843,7 +843,7 @@ esl_status_t esl_recv_event(esl_handle_t *handle, esl_event_t **save_event) } -esl_status_t esl_send(esl_handle_t *handle, const char *cmd) +ESL_DECLARE(esl_status_t) esl_send(esl_handle_t *handle, const char *cmd) { const char *e = cmd + strlen(cmd) -1; @@ -868,7 +868,7 @@ esl_status_t esl_send(esl_handle_t *handle, const char *cmd) } -esl_status_t esl_send_recv(esl_handle_t *handle, const char *cmd) +ESL_DECLARE(esl_status_t) esl_send_recv(esl_handle_t *handle, const char *cmd) { const char *hval; esl_status_t status; diff --git a/libs/esl/src/esl_config.c b/libs/esl/src/esl_config.c index 9773559b08..b781d83e7a 100644 --- a/libs/esl/src/esl_config.c +++ b/libs/esl/src/esl_config.c @@ -34,7 +34,7 @@ #include "esl.h" #include "esl_config.h" -int esl_config_open_file(esl_config_t *cfg, const char *file_path) +ESL_DECLARE(int) esl_config_open_file(esl_config_t *cfg, const char *file_path) { FILE *f; const char *path = NULL; @@ -91,7 +91,7 @@ int esl_config_open_file(esl_config_t *cfg, const char *file_path) } } -void esl_config_close_file(esl_config_t *cfg) +ESL_DECLARE(void) esl_config_close_file(esl_config_t *cfg) { if (cfg->file) { @@ -103,7 +103,7 @@ void esl_config_close_file(esl_config_t *cfg) -int esl_config_next_pair(esl_config_t *cfg, char **var, char **val) +ESL_DECLARE(int) esl_config_next_pair(esl_config_t *cfg, char **var, char **val) { int ret = 0; char *p, *end; @@ -209,7 +209,7 @@ int esl_config_next_pair(esl_config_t *cfg, char **var, char **val) } -int esl_config_get_cas_bits(char *strvalue, unsigned char *outbits) +ESL_DECLARE(int) esl_config_get_cas_bits(char *strvalue, unsigned char *outbits) { char cas_bits[5]; unsigned char bit = 0x8; diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index b6a57b6916..d7d841bd4f 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -121,12 +121,12 @@ static const char *EVENT_NAMES[] = { "ALL" }; -const char *esl_event_name(esl_event_types_t event) +ESL_DECLARE(const char *)esl_event_name(esl_event_types_t event) { return EVENT_NAMES[event]; } -esl_status_t esl_name_event(const char *name, esl_event_types_t *type) +ESL_DECLARE(esl_status_t) esl_name_event(const char *name, esl_event_types_t *type) { esl_event_types_t x; @@ -141,7 +141,7 @@ esl_status_t esl_name_event(const char *name, esl_event_types_t *type) } -esl_status_t esl_event_create_subclass(esl_event_t **event, esl_event_types_t event_id, const char *subclass_name) +ESL_DECLARE(esl_status_t) esl_event_create_subclass(esl_event_t **event, esl_event_types_t event_id, const char *subclass_name) { *event = NULL; @@ -166,7 +166,7 @@ esl_status_t esl_event_create_subclass(esl_event_t **event, esl_event_types_t ev } -const char *esl_priority_name(esl_priority_t priority) +ESL_DECLARE(const char *)esl_priority_name(esl_priority_t priority) { switch (priority) { /*lol */ case ESL_PRIORITY_NORMAL: @@ -180,7 +180,7 @@ const char *esl_priority_name(esl_priority_t priority) } } -esl_status_t esl_event_set_priority(esl_event_t *event, esl_priority_t priority) +ESL_DECLARE(esl_status_t) esl_event_set_priority(esl_event_t *event, esl_priority_t priority) { event->priority = priority; esl_event_add_header_string(event, ESL_STACK_TOP, "priority", esl_priority_name(priority)); @@ -213,7 +213,7 @@ static unsigned int esl_ci_hashfunc_default(const char *char_key, esl_ssize_t *k } -char *esl_event_get_header(esl_event_t *event, const char *header_name) +ESL_DECLARE(char *)esl_event_get_header(esl_event_t *event, const char *header_name) { esl_event_header_t *hp; esl_ssize_t hlen = -1; @@ -233,12 +233,12 @@ char *esl_event_get_header(esl_event_t *event, const char *header_name) return NULL; } -char *esl_event_get_body(esl_event_t *event) +ESL_DECLARE(char *)esl_event_get_body(esl_event_t *event) { return (event ? event->body : NULL); } -esl_status_t esl_event_del_header(esl_event_t *event, const char *header_name) +ESL_DECLARE(esl_status_t) esl_event_del_header(esl_event_t *event, const char *header_name) { esl_event_header_t *hp, *lp = NULL, *tp; esl_status_t status = ESL_FAIL; @@ -311,6 +311,8 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st return ESL_SUCCESS; } +int vasprintf(char **ret, const char *format, va_list ap); + static int esl_vasprintf(char **ret, const char *fmt, va_list ap) { #ifndef WIN32 @@ -348,7 +350,7 @@ static int esl_vasprintf(char **ret, const char *fmt, va_list ap) } -esl_status_t esl_event_add_header(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *fmt, ...) +ESL_DECLARE(esl_status_t) esl_event_add_header(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *fmt, ...) { int ret = 0; char *data; @@ -365,7 +367,7 @@ esl_status_t esl_event_add_header(esl_event_t *event, esl_stack_t stack, const c return esl_event_base_add_header(event, stack, header_name, data); } -esl_status_t esl_event_add_header_string(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *data) +ESL_DECLARE(esl_status_t) esl_event_add_header_string(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *data) { if (data) { return esl_event_base_add_header(event, stack, header_name, DUP(data)); @@ -373,7 +375,7 @@ esl_status_t esl_event_add_header_string(esl_event_t *event, esl_stack_t stack, return ESL_FAIL; } -esl_status_t esl_event_add_body(esl_event_t *event, const char *fmt, ...) +ESL_DECLARE(esl_status_t) esl_event_add_body(esl_event_t *event, const char *fmt, ...) { int ret = 0; char *data; @@ -396,7 +398,7 @@ esl_status_t esl_event_add_body(esl_event_t *event, const char *fmt, ...) } } -void esl_event_destroy(esl_event_t **event) +ESL_DECLARE(void) esl_event_destroy(esl_event_t **event) { esl_event_t *ep = *event; esl_event_header_t *hp, *this; @@ -420,7 +422,7 @@ void esl_event_destroy(esl_event_t **event) -esl_status_t esl_event_dup(esl_event_t **event, esl_event_t *todup) +ESL_DECLARE(esl_status_t) esl_event_dup(esl_event_t **event, esl_event_t *todup) { esl_event_header_t *header, *hp, *hp2, *last = NULL; @@ -463,7 +465,7 @@ esl_status_t esl_event_dup(esl_event_t **event, esl_event_t *todup) return ESL_SUCCESS; } -esl_status_t esl_event_serialize(esl_event_t *event, char **str, esl_bool_t encode) +ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, esl_bool_t encode) { size_t len = 0; esl_event_header_t *hp; diff --git a/libs/esl/src/esl_threadmutex.c b/libs/esl/src/esl_threadmutex.c index a24684c521..2aed18ad62 100644 --- a/libs/esl/src/esl_threadmutex.c +++ b/libs/esl/src/esl_threadmutex.c @@ -80,7 +80,7 @@ static void * ESL_THREAD_CALLING_CONVENTION thread_launch(void *args) return exit_val; } -esl_status_t esl_thread_create_detached(esl_thread_function_t func, void *data) +ESL_DECLARE(esl_status_t) esl_thread_create_detached(esl_thread_function_t func, void *data) { return esl_thread_create_detached_ex(func, data, thread_default_stacksize); } @@ -132,7 +132,7 @@ esl_status_t esl_thread_create_detached_ex(esl_thread_function_t func, void *dat } -esl_status_t esl_mutex_create(esl_mutex_t **mutex) +ESL_DECLARE(esl_status_t) esl_mutex_create(esl_mutex_t **mutex) { esl_status_t status = ESL_FAIL; #ifndef WIN32 @@ -170,7 +170,7 @@ esl_status_t esl_mutex_create(esl_mutex_t **mutex) return status; } -esl_status_t esl_mutex_destroy(esl_mutex_t **mutex) +ESL_DECLARE(esl_status_t) esl_mutex_destroy(esl_mutex_t **mutex) { esl_mutex_t *mp = *mutex; *mutex = NULL; @@ -187,7 +187,7 @@ esl_status_t esl_mutex_destroy(esl_mutex_t **mutex) return ESL_SUCCESS; } -esl_status_t esl_mutex_lock(esl_mutex_t *mutex) +ESL_DECLARE(esl_status_t) esl_mutex_lock(esl_mutex_t *mutex) { #ifdef WIN32 EnterCriticalSection(&mutex->mutex); @@ -198,7 +198,7 @@ esl_status_t esl_mutex_lock(esl_mutex_t *mutex) return ESL_SUCCESS; } -esl_status_t esl_mutex_trylock(esl_mutex_t *mutex) +ESL_DECLARE(esl_status_t) esl_mutex_trylock(esl_mutex_t *mutex) { #ifdef WIN32 if (!TryEnterCriticalSection(&mutex->mutex)) @@ -210,7 +210,7 @@ esl_status_t esl_mutex_trylock(esl_mutex_t *mutex) return ESL_SUCCESS; } -esl_status_t esl_mutex_unlock(esl_mutex_t *mutex) +ESL_DECLARE(esl_status_t) esl_mutex_unlock(esl_mutex_t *mutex) { #ifdef WIN32 LeaveCriticalSection(&mutex->mutex); diff --git a/libs/esl/src/include/esl.h b/libs/esl/src/include/esl.h index 806d6bc2f1..dbdfb70676 100644 --- a/libs/esl/src/include/esl.h +++ b/libs/esl/src/include/esl.h @@ -34,10 +34,7 @@ #ifndef _ESL_H_ #define _ESL_H_ - #include -int vasprintf(char **ret, const char *format, va_list ap); - #define esl_copy_string(_x, _y, _z) strncpy(_x, _y, _z - 1) #define esl_set_string(_x, _y) esl_copy_string(_x, _y, sizeof(_x)) @@ -45,7 +42,6 @@ int vasprintf(char **ret, const char *format, va_list ap); typedef struct esl_event_header esl_event_header_t; typedef struct esl_event esl_event_t; - #define ESL_SEQ_ESC "\033[" /* Ansi Control character suffixes */ #define ESL_SEQ_HOME_CHAR 'H' @@ -196,7 +192,23 @@ typedef intptr_t esl_ssize_t; typedef int esl_filehandle_t; #define ESL_SOCK_INVALID INVALID_SOCKET #define strerror_r(num, buf, size) strerror_s(buf, size, num) +#if defined(ESL_DECLARE_STATIC) +#define ESL_DECLARE(type) type __stdcall +#define ESL_DECLARE_NONSTD(type) type __cdecl +#define ESL_DECLARE_DATA +#elif defined(ESL_EXPORTS) +#define ESL_DECLARE(type) __declspec(dllexport) type __stdcall +#define ESL_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl +#define ESL_DECLARE_DATA __declspec(dllexport) +#else +#define ESL_DECLARE(type) __declspec(dllimport) type __stdcall +#define ESL_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl +#define ESL_DECLARE_DATA __declspec(dllimport) +#endif #else +#define ESL_DECLARE(type) type +#define ESL_DECLARE_NONSTD(type) type +#define ESL_DECLARE_DATA #include #include #include @@ -218,7 +230,6 @@ typedef enum { ESL_BREAK } esl_status_t; - #include typedef struct { @@ -279,27 +290,27 @@ void esl_global_set_default_logger(int level); #include "esl_threadmutex.h" #include "esl_config.h" -size_t esl_url_encode(const char *url, char *buf, size_t len); -char *esl_url_decode(char *s); -const char *esl_stristr(const char *instr, const char *str); -int esl_toupper(int c); -int esl_tolower(int c); -int esl_snprintf(char *buffer, size_t count, const char *fmt, ...); +ESL_DECLARE(size_t) esl_url_encode(const char *url, char *buf, size_t len); +ESL_DECLARE(char *)esl_url_decode(char *s); +ESL_DECLARE(const char *)esl_stristr(const char *instr, const char *str); +ESL_DECLARE(int) esl_toupper(int c); +ESL_DECLARE(int) esl_tolower(int c); +ESL_DECLARE(int) esl_snprintf(char *buffer, size_t count, const char *fmt, ...); typedef void (*esl_listen_callback_t)(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in addr); -esl_status_t esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in addr); -esl_status_t esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback); -esl_status_t esl_execute(esl_handle_t *handle, const char *app, const char *arg, const char *uuid); -esl_status_t esl_sendevent(esl_handle_t *handle, esl_event_t *event); +ESL_DECLARE(esl_status_t) esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in addr); +ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback); +ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, const char *arg, const char *uuid); +ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event); -esl_status_t esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password); -esl_status_t esl_disconnect(esl_handle_t *handle); -esl_status_t esl_send(esl_handle_t *handle, const char *cmd); -esl_status_t esl_recv_event(esl_handle_t *handle, esl_event_t **save_event); -esl_status_t esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t **save_event); -esl_status_t esl_send_recv(esl_handle_t *handle, const char *cmd); +ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password); +ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle); +ESL_DECLARE(esl_status_t) esl_send(esl_handle_t *handle, const char *cmd); +ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, esl_event_t **save_event); +ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t **save_event); +ESL_DECLARE(esl_status_t) esl_send_recv(esl_handle_t *handle, const char *cmd); #define esl_recv(_h) esl_recv_event(_h, NULL) #define esl_recv_timed(_h, _ms) esl_recv_event_timed(_h, _ms, NULL) diff --git a/libs/esl/src/include/esl_config.h b/libs/esl/src/include/esl_config.h index 934db157e3..aab50ff5d2 100644 --- a/libs/esl/src/include/esl_config.h +++ b/libs/esl/src/include/esl_config.h @@ -100,13 +100,13 @@ struct esl_config { \param file_path path to the file \return 1 (true) on success 0 (false) on failure */ -int esl_config_open_file(esl_config_t * cfg, const char *file_path); +ESL_DECLARE(int) esl_config_open_file(esl_config_t * cfg, const char *file_path); /*! \brief Close a previously opened configuration file \param cfg (esl_config_t *) config handle to use */ -void esl_config_close_file(esl_config_t * cfg); +ESL_DECLARE(void) esl_config_close_file(esl_config_t * cfg); /*! \brief Retrieve next name/value pair from configuration file @@ -114,14 +114,14 @@ void esl_config_close_file(esl_config_t * cfg); \param var pointer to aim at the new variable name \param val pointer to aim at the new value */ -int esl_config_next_pair(esl_config_t * cfg, char **var, char **val); +ESL_DECLARE(int) esl_config_next_pair(esl_config_t * cfg, char **var, char **val); /*! \brief Retrieve the CAS bits from a configuration string value \param strvalue pointer to the configuration string value (expected to be in format whatever:xxxx) \param outbits pointer to aim at the CAS bits */ -int esl_config_get_cas_bits(char *strvalue, unsigned char *outbits); +ESL_DECLARE(int) esl_config_get_cas_bits(char *strvalue, unsigned char *outbits); /** @} */ diff --git a/libs/esl/src/include/esl_event.h b/libs/esl/src/include/esl_event.h index 56ca57c938..db9d5fae22 100644 --- a/libs/esl/src/include/esl_event.h +++ b/libs/esl/src/include/esl_event.h @@ -159,7 +159,7 @@ struct esl_event { \param subclass_name the subclass name for custom event (only valid when event_id is ESL_EVENT_CUSTOM) \return ESL_STATUS_SUCCESS on success */ -esl_status_t esl_event_create_subclass(esl_event_t **event, esl_event_types_t event_id, const char *subclass_name); +ESL_DECLARE(esl_status_t) esl_event_create_subclass(esl_event_t **event, esl_event_types_t event_id, const char *subclass_name); /*! \brief Set the priority of an event @@ -167,7 +167,7 @@ esl_status_t esl_event_create_subclass(esl_event_t **event, esl_event_types_t ev \param priority the event priority \return ESL_STATUS_SUCCESS */ -esl_status_t esl_event_set_priority(esl_event_t *event, esl_priority_t priority); +ESL_DECLARE(esl_status_t) esl_event_set_priority(esl_event_t *event, esl_priority_t priority); /*! \brief Retrieve a header value from an event @@ -175,14 +175,14 @@ esl_status_t esl_event_set_priority(esl_event_t *event, esl_priority_t priority) \param header_name the name of the header to read \return the value of the requested header */ -char *esl_event_get_header(esl_event_t *event, const char *header_name); +ESL_DECLARE(char *)esl_event_get_header(esl_event_t *event, const char *header_name); /*! \brief Retrieve the body value from an event \param event the event to read the body from \return the value of the body or NULL */ -char *esl_event_get_body(esl_event_t *event); +ESL_DECLARE(char *)esl_event_get_body(esl_event_t *event); /*! \brief Add a header to an event @@ -192,7 +192,7 @@ char *esl_event_get_body(esl_event_t *event); \param fmt the value of the header (varargs see standard sprintf family) \return ESL_STATUS_SUCCESS if the header was added */ -esl_status_t esl_event_add_header(esl_event_t *event, esl_stack_t stack, +ESL_DECLARE(esl_status_t) esl_event_add_header(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *fmt, ...); //PRINTF_FUNCTION(4, 5); /*! @@ -203,15 +203,15 @@ esl_status_t esl_event_add_header(esl_event_t *event, esl_stack_t stack, \param data the value of the header \return ESL_STATUS_SUCCESS if the header was added */ -esl_status_t esl_event_add_header_string(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *data); +ESL_DECLARE(esl_status_t) esl_event_add_header_string(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *data); -esl_status_t esl_event_del_header(esl_event_t *event, const char *header_name); +ESL_DECLARE(esl_status_t) esl_event_del_header(esl_event_t *event, const char *header_name); /*! \brief Destroy an event \param event pointer to the pointer to event to destroy */ -void esl_event_destroy(esl_event_t **event); +ESL_DECLARE(void) esl_event_destroy(esl_event_t **event); #define esl_event_safe_destroy(_event) if (_event) esl_event_destroy(_event) /*! @@ -220,14 +220,14 @@ void esl_event_destroy(esl_event_t **event); \param todup an event to duplicate \return ESL_STATUS_SUCCESS if the event was duplicated */ -esl_status_t esl_event_dup(esl_event_t **event, esl_event_t *todup); +ESL_DECLARE(esl_status_t) esl_event_dup(esl_event_t **event, esl_event_t *todup); /*! \brief Render the name of an event id enumeration \param event the event id to render the name of \return the rendered name */ -const char *esl_event_name(esl_event_types_t event); +ESL_DECLARE(const char *)esl_event_name(esl_event_types_t event); /*! \brief return the event id that matches a given event name @@ -235,7 +235,7 @@ const char *esl_event_name(esl_event_types_t event); \param type the event id to return \return ESL_STATUS_SUCCESS if there was a match */ -esl_status_t esl_name_event(const char *name, esl_event_types_t *type); +ESL_DECLARE(esl_status_t) esl_name_event(const char *name, esl_event_types_t *type); /*! \brief Render a string representation of an event sutable for printing or network transport @@ -245,7 +245,7 @@ esl_status_t esl_name_event(const char *name, esl_event_types_t *type); \return ESL_STATUS_SUCCESS if the operation was successful \note you must free the resulting string when you are finished with it */ -esl_status_t esl_event_serialize(esl_event_t *event, char **str, esl_bool_t encode); +ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, esl_bool_t encode); /*! \brief Add a body to an event @@ -254,7 +254,7 @@ esl_status_t esl_event_serialize(esl_event_t *event, char **str, esl_bool_t enco \return ESL_STATUS_SUCCESS if the body was added to the event \note the body parameter can be shadowed by the esl_event_reserve_subclass_detailed function */ -esl_status_t esl_event_add_body(esl_event_t *event, const char *fmt, ...); +ESL_DECLARE(esl_status_t) esl_event_add_body(esl_event_t *event, const char *fmt, ...); /*! \brief Create a new event assuming it will not be custom event and therefore hiding the unused parameters @@ -264,7 +264,7 @@ esl_status_t esl_event_add_body(esl_event_t *event, const char *fmt, ...); */ #define esl_event_create(event, id) esl_event_create_subclass(event, id, ESL_EVENT_SUBCLASS_ANY) -const char *esl_priority_name(esl_priority_t priority); +ESL_DECLARE(const char *)esl_priority_name(esl_priority_t priority); ///\} diff --git a/libs/esl/src/include/esl_threadmutex.h b/libs/esl/src/include/esl_threadmutex.h index ab7d834829..3355f57724 100644 --- a/libs/esl/src/include/esl_threadmutex.h +++ b/libs/esl/src/include/esl_threadmutex.h @@ -27,14 +27,14 @@ typedef struct esl_mutex esl_mutex_t; typedef struct esl_thread esl_thread_t; typedef void *(*esl_thread_function_t) (esl_thread_t *, void *); -esl_status_t esl_thread_create_detached(esl_thread_function_t func, void *data); +ESL_DECLARE(esl_status_t) esl_thread_create_detached(esl_thread_function_t func, void *data); esl_status_t esl_thread_create_detached_ex(esl_thread_function_t func, void *data, size_t stack_size); void esl_thread_override_default_stacksize(size_t size); -esl_status_t esl_mutex_create(esl_mutex_t **mutex); -esl_status_t esl_mutex_destroy(esl_mutex_t **mutex); -esl_status_t esl_mutex_lock(esl_mutex_t *mutex); -esl_status_t esl_mutex_trylock(esl_mutex_t *mutex); -esl_status_t esl_mutex_unlock(esl_mutex_t *mutex); +ESL_DECLARE(esl_status_t) esl_mutex_create(esl_mutex_t **mutex); +ESL_DECLARE(esl_status_t) esl_mutex_destroy(esl_mutex_t **mutex); +ESL_DECLARE(esl_status_t) esl_mutex_lock(esl_mutex_t *mutex); +ESL_DECLARE(esl_status_t) esl_mutex_trylock(esl_mutex_t *mutex); +ESL_DECLARE(esl_status_t) esl_mutex_unlock(esl_mutex_t *mutex); #endif