From 0cf38bfb29eaf557fb0a28410337eceeb2ce740a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 7 Mar 2020 01:32:36 -0600 Subject: [PATCH] Try out a representative sample of APIs from multiple libraries --- modules/ca/src/client/Makefile | 3 + modules/ca/src/client/access.cpp | 35 ++--- modules/ca/src/client/ca_client_context.cpp | 4 +- modules/ca/src/client/cacIO.h | 22 ++-- modules/ca/src/client/cadef.h | 135 ++++++++++---------- modules/ca/src/client/caerr.h | 6 +- modules/ca/src/client/db_access.h | 26 ++-- modules/database/src/ioc/Makefile | 3 + modules/database/src/ioc/db/dbChannel.h | 38 +++--- modules/database/src/ioc/db/dbJLink.c | 6 +- modules/database/src/ioc/db/dbJLink.h | 16 +-- modules/database/src/std/Makefile | 3 + modules/libcom/src/Makefile | 4 + modules/libcom/src/yajl/yajl.c | 1 - modules/libcom/src/yajl/yajl_alloc.c | 1 - modules/libcom/src/yajl/yajl_buf.c | 1 - modules/libcom/src/yajl/yajl_common.h | 4 +- modules/libcom/src/yajl/yajl_encode.c | 1 - modules/libcom/src/yajl/yajl_gen.c | 1 - modules/libcom/src/yajl/yajl_lex.c | 1 - modules/libcom/src/yajl/yajl_parser.c | 1 - 21 files changed, 157 insertions(+), 155 deletions(-) diff --git a/modules/ca/src/client/Makefile b/modules/ca/src/client/Makefile index fa7d0916f..57d113e6b 100644 --- a/modules/ca/src/client/Makefile +++ b/modules/ca/src/client/Makefile @@ -73,6 +73,9 @@ LIBSRCS += comBuf.cpp LIBSRCS += hostNameCache.cpp LIBSRCS += msgForMultiplyDefinedPV.cpp +API_HEADER = libCaAPI.h +ca_API = libCa + LIBRARY=ca ca_RCS = ca.rc diff --git a/modules/ca/src/client/access.cpp b/modules/ca/src/client/access.cpp index a36899c02..b39406014 100644 --- a/modules/ca/src/client/access.cpp +++ b/modules/ca/src/client/access.cpp @@ -785,8 +785,7 @@ void epicsShareAPI ca_self_test () pcac->selfTest (); } -// extern "C" -epicsShareDef const int epicsTypeToDBR_XXXX [lastEpicsType+1] = { +const int epicsTypeToDBR_XXXX [lastEpicsType+1] = { DBR_SHORT, /* forces conversion fronm uint8 to int16 */ DBR_CHAR, DBR_SHORT, @@ -800,8 +799,7 @@ epicsShareDef const int epicsTypeToDBR_XXXX [lastEpicsType+1] = { DBR_STRING }; -// extern "C" -epicsShareDef const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1] = { +const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1] = { epicsOldStringT, epicsInt16T, epicsFloat32T, @@ -848,8 +846,7 @@ epicsShareDef const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1] = { epicsOldStringT }; -// extern "C" -epicsShareDef const unsigned short dbr_size[LAST_BUFFER_TYPE+1] = { +const unsigned short dbr_size[LAST_BUFFER_TYPE+1] = { sizeof(dbr_string_t), /* string max size */ sizeof(dbr_short_t), /* short */ sizeof(dbr_float_t), /* IEEE Float */ @@ -898,8 +895,7 @@ epicsShareDef const unsigned short dbr_size[LAST_BUFFER_TYPE+1] = { sizeof(dbr_string_t), /* string max size */ }; -// extern "C" -epicsShareDef const unsigned short dbr_value_size[LAST_BUFFER_TYPE+1] = { +const unsigned short dbr_value_size[LAST_BUFFER_TYPE+1] = { sizeof(dbr_string_t), /* string max size */ sizeof(dbr_short_t), /* short */ sizeof(dbr_float_t), /* IEEE Float */ @@ -949,7 +945,7 @@ epicsShareDef const unsigned short dbr_value_size[LAST_BUFFER_TYPE+1] = { }; //extern "C" -epicsShareDef const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1] = { +const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1] = { dbr_class_string, /* string max size */ dbr_class_int, /* short */ dbr_class_float, /* IEEE Float */ @@ -995,8 +991,7 @@ epicsShareDef const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1] = { dbr_class_string, /* string max size */ }; -// extern "C" -epicsShareDef const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1] = { +const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1] = { 0, /* string */ 0, /* short */ 0, /* IEEE Float */ @@ -1038,8 +1033,7 @@ epicsShareDef const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1] = { 0, /* string */ }; -// extern "C" -epicsShareDef const char *dbf_text[LAST_TYPE+3] = { +const char *dbf_text[LAST_TYPE+3] = { "TYPENOTCONN", "DBF_STRING", "DBF_SHORT", @@ -1051,14 +1045,11 @@ epicsShareDef const char *dbf_text[LAST_TYPE+3] = { "DBF_NO_ACCESS" }; -// extern "C" -epicsShareDef const char *dbf_text_invalid = "DBF_invalid"; +const char *dbf_text_invalid = "DBF_invalid"; -// extern "C" -epicsShareDef const short dbf_text_dim = (sizeof dbf_text)/(sizeof (char *)); +const short dbf_text_dim = (sizeof dbf_text)/(sizeof (char *)); -// extern "C" -epicsShareDef const char *dbr_text[LAST_BUFFER_TYPE+1] = { +const char *dbr_text[LAST_BUFFER_TYPE+1] = { "DBR_STRING", "DBR_SHORT", "DBR_FLOAT", @@ -1100,8 +1091,6 @@ epicsShareDef const char *dbr_text[LAST_BUFFER_TYPE+1] = { "DBR_CLASS_NAME" }; -// extern "C" -epicsShareDef const char *dbr_text_invalid = "DBR_invalid"; +const char *dbr_text_invalid = "DBR_invalid"; -// extern "C" -epicsShareDef const short dbr_text_dim = (sizeof dbr_text) / (sizeof (char *)) + 1; +const short dbr_text_dim = (sizeof dbr_text) / (sizeof (char *)) + 1; diff --git a/modules/ca/src/client/ca_client_context.cpp b/modules/ca/src/client/ca_client_context.cpp index 3fd0512d6..011a4f105 100644 --- a/modules/ca/src/client/ca_client_context.cpp +++ b/modules/ca/src/client/ca_client_context.cpp @@ -39,7 +39,7 @@ #include "oldAccess.h" #include "cac.h" -epicsShareDef epicsThreadPrivateId caClientCallbackThreadId; +epicsThreadPrivateId caClientCallbackThreadId; static epicsThreadOnceId cacOnce = EPICS_THREAD_ONCE_INIT; @@ -741,7 +741,7 @@ void epicsShareAPI caInstallDefaultService ( cacService & service ) ca_client_context::installDefaultService ( service ); } -epicsShareFunc int epicsShareAPI ca_clear_subscription ( evid pMon ) +LIBCA_API int epicsShareAPI ca_clear_subscription ( evid pMon ) { oldChannelNotify & chan = pMon->channel (); ca_client_context & cac = chan.getClientCtx (); diff --git a/modules/ca/src/client/cacIO.h b/modules/ca/src/client/cacIO.h index 4e8af4a05..f75c18cc4 100644 --- a/modules/ca/src/client/cacIO.h +++ b/modules/ca/src/client/cacIO.h @@ -62,6 +62,8 @@ # include "shareLib.h" #endif +#include "libCaAPI.h" + class cacChannel; @@ -69,7 +71,7 @@ typedef unsigned long arrayElementCount; // 1) this should not be passing caerr.h status to the exception callback // 2) needless-to-say the data should be passed here using the new data access API -class epicsShareClass cacWriteNotify { +class LIBCA_API cacWriteNotify { public: virtual ~cacWriteNotify () = 0; virtual void completion ( epicsGuard < epicsMutex > & ) = 0; @@ -82,7 +84,7 @@ public: // 1) this should not be passing caerr.h status to the exception callback // 2) needless-to-say the data should be passed here using the new data access API -class epicsShareClass cacReadNotify { +class LIBCA_API cacReadNotify { public: virtual ~cacReadNotify () = 0; virtual void completion ( @@ -97,7 +99,7 @@ public: // 1) this should not be passing caerr.h status to the exception callback // 2) needless-to-say the data should be passed here using the new data access API -class epicsShareClass cacStateNotify { +class LIBCA_API cacStateNotify { public: virtual ~cacStateNotify () = 0; virtual void current ( @@ -131,7 +133,7 @@ private: bool f_operatorConfirmationRequest:1; }; -class epicsShareClass cacChannelNotify { +class LIBCA_API cacChannelNotify { public: virtual ~cacChannelNotify () = 0; virtual void connectNotify ( epicsGuard < epicsMutex > & ) = 0; @@ -169,7 +171,7 @@ private: // but perhaps is a bad practice that should be eliminated? If so, // then the IO should not store or use a pointer to the channel. // -class epicsShareClass cacChannel { +class LIBCA_API cacChannel { public: typedef unsigned priLev; static const priLev priorityMax; @@ -277,7 +279,7 @@ private: cacChannel & operator = ( const cacChannel & ); }; -class epicsShareClass cacContext { +class LIBCA_API cacContext { public: virtual ~cacContext (); virtual cacChannel & createChannel ( @@ -296,7 +298,7 @@ public: epicsGuard < epicsMutex > &, unsigned level ) const = 0; }; -class epicsShareClass cacContextNotify { +class LIBCA_API cacContextNotify { public: virtual ~cacContextNotify () = 0; virtual cacContext & createNetworkContext ( @@ -316,7 +318,7 @@ public: // **** Lock Hierarchy **** // callbackControl must be taken before mutualExclusion if both are held at // the same time -class epicsShareClass cacService { +class LIBCA_API cacService { public: virtual ~cacService () = 0; virtual cacContext & contextCreate ( @@ -325,9 +327,9 @@ public: cacContextNotify & ) = 0; }; -epicsShareFunc void epicsShareAPI caInstallDefaultService ( cacService & service ); +LIBCA_API void epicsShareAPI caInstallDefaultService ( cacService & service ); -epicsShareExtern epicsThreadPrivateId caClientCallbackThreadId; +LIBCA_API extern epicsThreadPrivateId caClientCallbackThreadId; inline cacChannel::cacChannel ( cacChannelNotify & notify ) : callback ( notify ) diff --git a/modules/ca/src/client/cadef.h b/modules/ca/src/client/cadef.h index e62dd7249..1b37be3f9 100644 --- a/modules/ca/src/client/cadef.h +++ b/modules/ca/src/client/cadef.h @@ -44,6 +44,7 @@ # include "shareLib.h" #endif +#include "libCaAPI.h" #include "caerr.h" #include "db_access.h" @@ -102,7 +103,7 @@ typedef struct event_handler_args { } evargs; typedef void caEventCallBackFunc (struct event_handler_args); -epicsShareFunc void epicsShareAPI ca_test_event +LIBCA_API void epicsShareAPI ca_test_event ( struct event_handler_args ); @@ -158,13 +159,13 @@ typedef unsigned CA_SYNC_GID; #define TYPENOTCONN (-1) /* the channel's native type when disconnected */ -epicsShareFunc short epicsShareAPI ca_field_type (chid chan); -epicsShareFunc unsigned long epicsShareAPI ca_element_count (chid chan); -epicsShareFunc const char * epicsShareAPI ca_name (chid chan); -epicsShareFunc void epicsShareAPI ca_set_puser (chid chan, void *puser); -epicsShareFunc void * epicsShareAPI ca_puser (chid chan); -epicsShareFunc unsigned epicsShareAPI ca_read_access (chid chan); -epicsShareFunc unsigned epicsShareAPI ca_write_access (chid chan); +LIBCA_API short epicsShareAPI ca_field_type (chid chan); +LIBCA_API unsigned long epicsShareAPI ca_element_count (chid chan); +LIBCA_API const char * epicsShareAPI ca_name (chid chan); +LIBCA_API void epicsShareAPI ca_set_puser (chid chan, void *puser); +LIBCA_API void * epicsShareAPI ca_puser (chid chan); +LIBCA_API unsigned epicsShareAPI ca_read_access (chid chan); +LIBCA_API unsigned epicsShareAPI ca_write_access (chid chan); /* * cs_ - `channel state' @@ -175,27 +176,27 @@ epicsShareFunc unsigned epicsShareAPI ca_write_access (chid chan); * cs_closed channel deleted by user */ enum channel_state {cs_never_conn, cs_prev_conn, cs_conn, cs_closed}; -epicsShareFunc enum channel_state epicsShareAPI ca_state (chid chan); +LIBCA_API enum channel_state epicsShareAPI ca_state (chid chan); /************************************************************************/ /* Perform Library Initialization */ /* */ /* Must be called once before calling any of the other routines */ /************************************************************************/ -epicsShareFunc int epicsShareAPI ca_task_initialize (void); +LIBCA_API int epicsShareAPI ca_task_initialize (void); enum ca_preemptive_callback_select { ca_disable_preemptive_callback, ca_enable_preemptive_callback }; -epicsShareFunc int epicsShareAPI +LIBCA_API int epicsShareAPI ca_context_create (enum ca_preemptive_callback_select select); -epicsShareFunc void epicsShareAPI ca_detach_context (); +LIBCA_API void epicsShareAPI ca_detach_context (); /************************************************************************/ /* Remove CA facility from your task */ /* */ /* Normally called automatically at task exit */ /************************************************************************/ -epicsShareFunc int epicsShareAPI ca_task_exit (void); -epicsShareFunc void epicsShareAPI ca_context_destroy (void); +LIBCA_API int epicsShareAPI ca_task_exit (void); +LIBCA_API void epicsShareAPI ca_context_destroy (void); typedef unsigned capri; #define CA_PRIORITY_MAX 99 @@ -218,7 +219,7 @@ typedef unsigned capri; * priority R priority level in the server 0 - 100 * pChanID RW channel id written here */ -epicsShareFunc int epicsShareAPI ca_create_channel +LIBCA_API int epicsShareAPI ca_create_channel ( const char *pChanName, caCh *pConnStateCallback, @@ -233,7 +234,7 @@ epicsShareFunc int epicsShareAPI ca_create_channel * chan R channel identifier * pfunc R address of connection call-back function */ -epicsShareFunc int epicsShareAPI ca_change_connection_event +LIBCA_API int epicsShareAPI ca_change_connection_event ( chid chan, caCh * pfunc @@ -245,7 +246,7 @@ epicsShareFunc int epicsShareAPI ca_change_connection_event * chan R channel identifier * pfunc R address of access rights call-back function */ -epicsShareFunc int epicsShareAPI ca_replace_access_rights_event ( +LIBCA_API int epicsShareAPI ca_replace_access_rights_event ( chid chan, caArh *pfunc ); @@ -260,7 +261,7 @@ epicsShareFunc int epicsShareAPI ca_replace_access_rights_event ( * call-back function */ typedef void caExceptionHandler (struct exception_handler_args); -epicsShareFunc int epicsShareAPI ca_add_exception_event +LIBCA_API int epicsShareAPI ca_add_exception_event ( caExceptionHandler *pfunc, void *pArg @@ -272,7 +273,7 @@ epicsShareFunc int epicsShareAPI ca_add_exception_event * * chanId R channel ID */ -epicsShareFunc int epicsShareAPI ca_clear_channel +LIBCA_API int epicsShareAPI ca_clear_channel ( chid chanId ); @@ -320,7 +321,7 @@ ca_array_put(DBR_FLOAT, 1u, chan, (const dbr_float_t *) pValue) * chan R channel identifier * pValue R new channel value copied from this location */ -epicsShareFunc int epicsShareAPI ca_array_put +LIBCA_API int epicsShareAPI ca_array_put ( chtype type, unsigned long count, @@ -345,7 +346,7 @@ epicsShareFunc int epicsShareAPI ca_array_put * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc */ -epicsShareFunc int epicsShareAPI ca_array_put_callback +LIBCA_API int epicsShareAPI ca_array_put_callback ( chtype type, unsigned long count, @@ -402,7 +403,7 @@ ca_array_get(DBR_FLOAT, 1u, chan, (dbr_float_t *)(pValue)) * chan R channel identifier * pValue W channel value copied to this location */ -epicsShareFunc int epicsShareAPI ca_array_get +LIBCA_API int epicsShareAPI ca_array_get ( chtype type, unsigned long count, @@ -461,7 +462,7 @@ ca_array_get_callback (type, 1u, chan, pFunc, pArg) * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc */ -epicsShareFunc int epicsShareAPI ca_array_get_callback +LIBCA_API int epicsShareAPI ca_array_get_callback ( chtype type, unsigned long count, @@ -491,7 +492,7 @@ epicsShareFunc int epicsShareAPI ca_array_get_callback * pArg R copy of this pointer passed to pFunc * pEventID W event id written at specified address */ -epicsShareFunc int epicsShareAPI ca_create_subscription +LIBCA_API int epicsShareAPI ca_create_subscription ( chtype type, unsigned long count, @@ -512,12 +513,12 @@ epicsShareFunc int epicsShareAPI ca_create_subscription * * eventID R event id */ -epicsShareFunc int epicsShareAPI ca_clear_subscription +LIBCA_API int epicsShareAPI ca_clear_subscription ( evid eventID ); -epicsShareFunc chid epicsShareAPI ca_evid_to_chid ( evid id ); +LIBCA_API chid epicsShareAPI ca_evid_to_chid ( evid id ); /************************************************************************/ @@ -571,7 +572,7 @@ epicsShareFunc chid epicsShareAPI ca_evid_to_chid ( evid id ); * * timeOut R wait for this delay in seconds */ -epicsShareFunc int epicsShareAPI ca_pend_event (ca_real timeOut); +LIBCA_API int epicsShareAPI ca_pend_event (ca_real timeOut); #define ca_poll() ca_pend_event(1e-12) /* @@ -581,10 +582,10 @@ epicsShareFunc int epicsShareAPI ca_pend_event (ca_real timeOut); * if all get requests (or search requests with null * connection handler pointer have completed) */ -epicsShareFunc int epicsShareAPI ca_pend_io (ca_real timeOut); +LIBCA_API int epicsShareAPI ca_pend_io (ca_real timeOut); /* calls ca_pend_io() if early is true otherwise ca_pend_event() is called */ -epicsShareFunc int epicsShareAPI ca_pend (ca_real timeout, int early); +LIBCA_API int epicsShareAPI ca_pend (ca_real timeout, int early); /* * ca_test_io() @@ -592,7 +593,7 @@ epicsShareFunc int epicsShareAPI ca_pend (ca_real timeout, int early); * returns TRUE when get requests (or search requests with null * connection handler pointer) are outstanding */ -epicsShareFunc int epicsShareAPI ca_test_io (void); +LIBCA_API int epicsShareAPI ca_test_io (void); /************************************************************************/ /* Send out all outstanding messages in the send queue */ @@ -600,7 +601,7 @@ epicsShareFunc int epicsShareAPI ca_test_io (void); /* * ca_flush_io() */ -epicsShareFunc int epicsShareAPI ca_flush_io (void); +LIBCA_API int epicsShareAPI ca_flush_io (void); /* @@ -609,7 +610,7 @@ epicsShareFunc int epicsShareAPI ca_flush_io (void); * errorCode R status returned from channel access function * pCtxStr R context string included with error print out */ -epicsShareFunc void epicsShareAPI ca_signal +LIBCA_API void epicsShareAPI ca_signal ( long errorCode, const char *pCtxStr @@ -623,7 +624,7 @@ epicsShareFunc void epicsShareAPI ca_signal * lineNo R line number included with error print out * */ -epicsShareFunc void epicsShareAPI ca_signal_with_file_and_lineno +LIBCA_API void epicsShareAPI ca_signal_with_file_and_lineno ( long errorCode, const char *pCtxStr, @@ -639,7 +640,7 @@ epicsShareFunc void epicsShareAPI ca_signal_with_file_and_lineno * pFormat R printf dtyle format string (and optional arguments) * */ -epicsShareFunc void epicsShareAPI ca_signal_formated (long ca_status, const char *pfilenm, +LIBCA_API void epicsShareAPI ca_signal_formated (long ca_status, const char *pfilenm, int lineno, const char *pFormat, ...); /* @@ -649,9 +650,9 @@ epicsShareFunc void epicsShareAPI ca_signal_formated (long ca_status, const char * * !!!! this function is _not_ thread safe !!!! */ -epicsShareFunc const char * epicsShareAPI ca_host_name (chid channel); +LIBCA_API const char * epicsShareAPI ca_host_name (chid channel); /* thread safe version */ -epicsShareFunc unsigned epicsShareAPI ca_get_host_name ( chid pChan, +LIBCA_API unsigned epicsShareAPI ca_get_host_name ( chid pChan, char *pBuf, unsigned bufLength ); /* @@ -674,7 +675,7 @@ typedef void CAFDHANDLER (void *parg, int fd, int opened); * when an fd is created or deleted * pArg R argument passed to above function */ -epicsShareFunc int epicsShareAPI ca_add_fd_registration +LIBCA_API int epicsShareAPI ca_add_fd_registration ( CAFDHANDLER *pHandler, void *pArg @@ -698,7 +699,7 @@ epicsShareFunc int epicsShareAPI ca_add_fd_registration * * pgid W pointer to sync group id that will be written */ -epicsShareFunc int epicsShareAPI ca_sg_create (CA_SYNC_GID * pgid); +LIBCA_API int epicsShareAPI ca_sg_create (CA_SYNC_GID * pgid); /* * ca_sg_delete() @@ -707,7 +708,7 @@ epicsShareFunc int epicsShareAPI ca_sg_create (CA_SYNC_GID * pgid); * * gid R sync group id */ -epicsShareFunc int epicsShareAPI ca_sg_delete (const CA_SYNC_GID gid); +LIBCA_API int epicsShareAPI ca_sg_delete (const CA_SYNC_GID gid); /* * ca_sg_block() @@ -718,7 +719,7 @@ epicsShareFunc int epicsShareAPI ca_sg_delete (const CA_SYNC_GID gid); * timeout R wait for this duration prior to timing out * and returning ECA_TIMEOUT */ -epicsShareFunc int epicsShareAPI ca_sg_block (const CA_SYNC_GID gid, ca_real timeout); +LIBCA_API int epicsShareAPI ca_sg_block (const CA_SYNC_GID gid, ca_real timeout); /* * ca_sg_test() @@ -729,14 +730,14 @@ epicsShareFunc int epicsShareAPI ca_sg_block (const CA_SYNC_GID gid, ca_real tim * * returns one of ECA_BADSYNCGRP, ECA_IOINPROGRESS, ECA_IODONE */ -epicsShareFunc int epicsShareAPI ca_sg_test (const CA_SYNC_GID gid); +LIBCA_API int epicsShareAPI ca_sg_test (const CA_SYNC_GID gid); /* * ca_sg_reset * * gid R sync group id */ -epicsShareFunc int epicsShareAPI ca_sg_reset(const CA_SYNC_GID gid); +LIBCA_API int epicsShareAPI ca_sg_reset(const CA_SYNC_GID gid); /* * ca_sg_array_get() @@ -750,7 +751,7 @@ epicsShareFunc int epicsShareAPI ca_sg_reset(const CA_SYNC_GID gid); * chan R channel identifier * pValue W channel value copied to this location */ -epicsShareFunc int epicsShareAPI ca_sg_array_get +LIBCA_API int epicsShareAPI ca_sg_array_get ( const CA_SYNC_GID gid, chtype type, @@ -774,7 +775,7 @@ ca_sg_array_get (gid, type, 1u, chan, pValue) * chan R channel identifier * pValue R new channel value copied from this location */ -epicsShareFunc int epicsShareAPI ca_sg_array_put +LIBCA_API int epicsShareAPI ca_sg_array_put ( const CA_SYNC_GID gid, chtype type, @@ -793,9 +794,9 @@ ca_sg_array_put (gid, type, 1u, chan, pValue) * * gid R sync group id */ -epicsShareFunc int epicsShareAPI ca_sg_stat (CA_SYNC_GID gid); +LIBCA_API int epicsShareAPI ca_sg_stat (CA_SYNC_GID gid); -epicsShareFunc void epicsShareAPI ca_dump_dbr (chtype type, unsigned count, const void * pbuffer); +LIBCA_API void epicsShareAPI ca_dump_dbr (chtype type, unsigned count, const void * pbuffer); /* @@ -808,14 +809,14 @@ epicsShareFunc void epicsShareAPI ca_dump_dbr (chtype type, unsigned count, cons * * (returns true or false) */ -epicsShareFunc int epicsShareAPI ca_v42_ok (chid chan); +LIBCA_API int epicsShareAPI ca_v42_ok (chid chan); /* * ca_version() * * returns the CA version string */ -epicsShareFunc const char * epicsShareAPI ca_version (void); +LIBCA_API const char * epicsShareAPI ca_version (void); /* * ca_replace_printf_handler () @@ -830,7 +831,7 @@ epicsShareFunc const char * epicsShareAPI ca_version (void); */ #ifndef CA_DONT_INCLUDE_STDARGH typedef int caPrintfFunc (const char *pformat, va_list args); -epicsShareFunc int epicsShareAPI ca_replace_printf_handler ( +LIBCA_API int epicsShareAPI ca_replace_printf_handler ( caPrintfFunc *ca_printf_func ); #endif /*CA_DONT_INCLUDE_STDARGH*/ @@ -838,24 +839,24 @@ epicsShareFunc int epicsShareAPI ca_replace_printf_handler ( /* * (for testing purposes only) */ -epicsShareFunc unsigned epicsShareAPI ca_get_ioc_connection_count (void); -epicsShareFunc int epicsShareAPI ca_preemtive_callback_is_enabled (void); -epicsShareFunc void epicsShareAPI ca_self_test (void); -epicsShareFunc unsigned epicsShareAPI ca_beacon_anomaly_count (void); -epicsShareFunc unsigned epicsShareAPI ca_search_attempts (chid chan); -epicsShareFunc double epicsShareAPI ca_beacon_period (chid chan); -epicsShareFunc double epicsShareAPI ca_receive_watchdog_delay (chid chan); +LIBCA_API unsigned epicsShareAPI ca_get_ioc_connection_count (void); +LIBCA_API int epicsShareAPI ca_preemtive_callback_is_enabled (void); +LIBCA_API void epicsShareAPI ca_self_test (void); +LIBCA_API unsigned epicsShareAPI ca_beacon_anomaly_count (void); +LIBCA_API unsigned epicsShareAPI ca_search_attempts (chid chan); +LIBCA_API double epicsShareAPI ca_beacon_period (chid chan); +LIBCA_API double epicsShareAPI ca_receive_watchdog_delay (chid chan); /* * used when an auxillary thread needs to join a CA client context started * by another thread */ -epicsShareFunc struct ca_client_context * epicsShareAPI ca_current_context (); -epicsShareFunc int epicsShareAPI ca_attach_context ( struct ca_client_context * context ); +LIBCA_API struct ca_client_context * epicsShareAPI ca_current_context (); +LIBCA_API int epicsShareAPI ca_attach_context ( struct ca_client_context * context ); -epicsShareFunc int epicsShareAPI ca_client_status ( unsigned level ); -epicsShareFunc int epicsShareAPI ca_context_status ( struct ca_client_context *, unsigned level ); +LIBCA_API int epicsShareAPI ca_client_status ( unsigned level ); +LIBCA_API int epicsShareAPI ca_context_status ( struct ca_client_context *, unsigned level ); /* * deprecated @@ -864,16 +865,16 @@ epicsShareFunc int epicsShareAPI ca_context_status ( struct ca_client_context *, ca_build_and_connect(NAME, XXXXX, 1, CHIDPTR, YYYYY, 0, 0) #define ca_array_build(NAME,XXXXX, ZZZZZZ, CHIDPTR,YYYYY)\ ca_build_and_connect(NAME, XXXXX, ZZZZZZ, CHIDPTR, YYYYY, 0, 0) -epicsShareFunc int epicsShareAPI ca_build_and_connect +LIBCA_API int epicsShareAPI ca_build_and_connect ( const char *pChanName, chtype, unsigned long, chid * pChanID, void *, caCh * pFunc, void * pArg ); #define ca_search(pChanName, pChanID)\ ca_search_and_connect (pChanName, pChanID, 0, 0) -epicsShareFunc int epicsShareAPI ca_search_and_connect +LIBCA_API int epicsShareAPI ca_search_and_connect ( const char * pChanName, chid * pChanID, caCh *pFunc, void * pArg ); -epicsShareFunc int epicsShareAPI ca_channel_status (epicsThreadId tid); -epicsShareFunc int epicsShareAPI ca_clear_event ( evid eventID ); +LIBCA_API int epicsShareAPI ca_channel_status (epicsThreadId tid); +LIBCA_API int epicsShareAPI ca_clear_event ( evid eventID ); #define ca_add_event(type,chan,pFunc,pArg,pEventID)\ ca_add_array_event(type,1u,chan,pFunc,pArg,0.0,0.0,0.0,pEventID) #define ca_add_delta_event(TYPE,CHID,ENTRY,ARG,DELTA,EVID)\ @@ -882,7 +883,7 @@ ca_add_array_event(type,1u,chan,pFunc,pArg,0.0,0.0,0.0,pEventID) ca_add_array_event(TYPE,1,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID) #define ca_add_array_event(TYPE,COUNT,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID)\ ca_add_masked_array_event(TYPE,COUNT,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID, DBE_VALUE | DBE_ALARM) -epicsShareFunc int epicsShareAPI ca_add_masked_array_event +LIBCA_API int epicsShareAPI ca_add_masked_array_event ( chtype type, unsigned long count, chid chanId, caEventCallBackFunc * pFunc, void * pArg, ca_real p_delta, ca_real n_delta, ca_real timeout, evid * pEventID, long mask ); @@ -890,8 +891,8 @@ epicsShareFunc int epicsShareAPI ca_add_masked_array_event /* * defunct */ -epicsShareFunc int epicsShareAPI ca_modify_user_name ( const char *pUserName ); -epicsShareFunc int epicsShareAPI ca_modify_host_name ( const char *pHostName ); +LIBCA_API int epicsShareAPI ca_modify_user_name ( const char *pUserName ); +LIBCA_API int epicsShareAPI ca_modify_host_name ( const char *pHostName ); #ifdef __cplusplus } diff --git a/modules/ca/src/client/caerr.h b/modules/ca/src/client/caerr.h index 53930962d..4c0b36835 100644 --- a/modules/ca/src/client/caerr.h +++ b/modules/ca/src/client/caerr.h @@ -35,6 +35,8 @@ # include "shareLib.h" #endif +#include "libCaAPI.h" + /* CA Status Code Definitions */ #define CA_K_INFO 3 /* successful */ @@ -149,9 +151,9 @@ extern "C" { #endif -epicsShareFunc const char * epicsShareAPI ca_message(long ca_status); +LIBCA_API const char * epicsShareAPI ca_message(long ca_status); -epicsShareExtern const char * ca_message_text []; +LIBCA_API extern const char * ca_message_text []; #ifdef __cplusplus } diff --git a/modules/ca/src/client/db_access.h b/modules/ca/src/client/db_access.h index 92aa5d011..5ad565863 100644 --- a/modules/ca/src/client/db_access.h +++ b/modules/ca/src/client/db_access.h @@ -30,6 +30,8 @@ # include "shareLib.h" #endif +#include "libCaAPI.h" + #ifdef __cplusplus extern "C" { @@ -128,12 +130,12 @@ typedef epicsOldString dbr_class_name_t; * of type DBR types. In some cases we select the a * larger type to avoid loss of information */ -epicsShareExtern const int epicsTypeToDBR_XXXX [lastEpicsType+1]; +LIBCA_API extern const int epicsTypeToDBR_XXXX [lastEpicsType+1]; /* * The DBR_XXXX types are indicies into this array */ -epicsShareExtern const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1]; +LIBCA_API extern const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1]; /* values returned for each field type * DBR_STRING returns a NULL terminated string @@ -528,10 +530,10 @@ struct dbr_ctrl_double{ ((unsigned)((COUNT)<=0?dbr_size[TYPE]:dbr_size[TYPE]+((COUNT)-1)*dbr_value_size[TYPE])) /* size for each type - array indexed by the DBR_ type code */ -epicsShareExtern const unsigned short dbr_size[]; +LIBCA_API extern const unsigned short dbr_size[]; /* size for each type's value - array indexed by the DBR_ type code */ -epicsShareExtern const unsigned short dbr_value_size[]; +LIBCA_API extern const unsigned short dbr_value_size[]; #ifndef db_accessHFORdb_accessC /* class for each type's value */ @@ -541,7 +543,7 @@ enum dbr_value_class { dbr_class_string, dbr_class_max}; -epicsShareExtern const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1]; +LIBCA_API extern const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1]; /* * ptr to value given a pointer to the structure and the DBR type @@ -555,7 +557,7 @@ epicsShareExtern const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1]; #define dbr_value_ptr_from_structure(PDBR, STRUCTURE)\ ((void *)(((char *)PDBR)+BYTE_OS(STRUCTURE, value))) -epicsShareExtern const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1]; +LIBCA_API extern const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1]; /* union for each fetch buffers */ @@ -724,13 +726,13 @@ union db_access_val{ (type) + 4*(dbf_text_dim-2) : -1 ) -epicsShareExtern const char *dbf_text[LAST_TYPE+3]; -epicsShareExtern const short dbf_text_dim; -epicsShareExtern const char *dbf_text_invalid; +LIBCA_API extern const char *dbf_text[LAST_TYPE+3]; +LIBCA_API extern const short dbf_text_dim; +LIBCA_API extern const char *dbf_text_invalid; -epicsShareExtern const char *dbr_text[LAST_BUFFER_TYPE+1]; -epicsShareExtern const short dbr_text_dim; -epicsShareExtern const char *dbr_text_invalid; +LIBCA_API extern const char *dbr_text[LAST_BUFFER_TYPE+1]; +LIBCA_API extern const short dbr_text_dim; +LIBCA_API extern const char *dbr_text_invalid; #endif /*db_accessHFORdb_accessC*/ #ifdef __cplusplus diff --git a/modules/database/src/ioc/Makefile b/modules/database/src/ioc/Makefile index 70b1b5558..23c9c02b6 100644 --- a/modules/database/src/ioc/Makefile +++ b/modules/database/src/ioc/Makefile @@ -15,6 +15,9 @@ USR_CPPFLAGS += -DUSE_TYPED_RSET SHRLIB_VERSION = 3.17.0 +API_HEADER = dbCoreAPI.h +dbCore_API = dbCore + LIBRARY_IOC += dbCore dbCore_LIBS += ca Com dbCore_SYS_LIBS_WIN32 += ws2_32 diff --git a/modules/database/src/ioc/db/dbChannel.h b/modules/database/src/ioc/db/dbChannel.h index fab9c6627..e30270a1c 100644 --- a/modules/database/src/ioc/db/dbChannel.h +++ b/modules/database/src/ioc/db/dbChannel.h @@ -21,9 +21,9 @@ #include "ellLib.h" #include "epicsTypes.h" #include "errMdef.h" -#include "shareLib.h" #include "db_field_log.h" #include "dbEvent.h" +#include "dbCoreAPI.h" #ifdef __cplusplus extern "C" { @@ -148,14 +148,14 @@ struct chFilter { struct dbCommon; struct dbFldDes; -epicsShareFunc void dbChannelInit (void); -epicsShareFunc void dbChannelExit(void); -epicsShareFunc long dbChannelTest(const char *name); -epicsShareFunc dbChannel * dbChannelCreate(const char *name); -epicsShareFunc long dbChannelOpen(dbChannel *chan); +DBCORE_API void dbChannelInit (void); +DBCORE_API void dbChannelExit(void); +DBCORE_API long dbChannelTest(const char *name); +DBCORE_API dbChannel * dbChannelCreate(const char *name); +DBCORE_API long dbChannelOpen(dbChannel *chan); /*Following is also defined in db_convert.h*/ -epicsShareExtern unsigned short dbDBRnewToDBRold[]; +DBCORE_API extern unsigned short dbDBRnewToDBRold[]; /* In the following macros pChan is dbChannel* */ @@ -206,25 +206,25 @@ epicsShareExtern unsigned short dbDBRnewToDBRold[]; #define dbChannelField(pChan) ((pChan)->addr.pfield) -epicsShareFunc long dbChannelGet(dbChannel *chan, short type, +DBCORE_API long dbChannelGet(dbChannel *chan, short type, void *pbuffer, long *options, long *nRequest, void *pfl); -epicsShareFunc long dbChannelGetField(dbChannel *chan, short type, +DBCORE_API long dbChannelGetField(dbChannel *chan, short type, void *pbuffer, long *options, long *nRequest, void *pfl); -epicsShareFunc long dbChannelPut(dbChannel *chan, short type, +DBCORE_API long dbChannelPut(dbChannel *chan, short type, const void *pbuffer, long nRequest); -epicsShareFunc long dbChannelPutField(dbChannel *chan, short type, +DBCORE_API long dbChannelPutField(dbChannel *chan, short type, const void *pbuffer, long nRequest); -epicsShareFunc void dbChannelShow(dbChannel *chan, int level, +DBCORE_API void dbChannelShow(dbChannel *chan, int level, const unsigned short indent); -epicsShareFunc void dbChannelFilterShow(dbChannel *chan, int level, +DBCORE_API void dbChannelFilterShow(dbChannel *chan, int level, const unsigned short indent); -epicsShareFunc void dbChannelDelete(dbChannel *chan); +DBCORE_API void dbChannelDelete(dbChannel *chan); -epicsShareFunc void dbRegisterFilter(const char *key, const chFilterIf *fif, void *puser); -epicsShareFunc db_field_log* dbChannelRunPreChain(dbChannel *chan, db_field_log *pLogIn); -epicsShareFunc db_field_log* dbChannelRunPostChain(dbChannel *chan, db_field_log *pLogIn); -epicsShareFunc const chFilterPlugin * dbFindFilter(const char *key, size_t len); -epicsShareFunc void dbChannelMakeArrayCopy(void *pvt, db_field_log *pfl, dbChannel *chan); +DBCORE_API void dbRegisterFilter(const char *key, const chFilterIf *fif, void *puser); +DBCORE_API db_field_log* dbChannelRunPreChain(dbChannel *chan, db_field_log *pLogIn); +DBCORE_API db_field_log* dbChannelRunPostChain(dbChannel *chan, db_field_log *pLogIn); +DBCORE_API const chFilterPlugin * dbFindFilter(const char *key, size_t len); +DBCORE_API void dbChannelMakeArrayCopy(void *pvt, db_field_log *pfl, dbChannel *chan); #ifdef __cplusplus } diff --git a/modules/database/src/ioc/db/dbJLink.c b/modules/database/src/ioc/db/dbJLink.c index 3acf75660..7f8b41216 100644 --- a/modules/database/src/ioc/db/dbJLink.c +++ b/modules/database/src/ioc/db/dbJLink.c @@ -27,7 +27,7 @@ #include "link.h" #include "epicsExport.h" -epicsShareDef int dbJLinkDebug = 0; +int dbJLinkDebug = 0; epicsExportAddress(int, dbJLinkDebug); #define IFDEBUG(n) if (dbJLinkDebug >= (n)) @@ -39,12 +39,12 @@ typedef struct parseContext { short jsonDepth; } parseContext; -epicsShareDef const char *jlif_result_name[2] = { +const char *jlif_result_name[2] = { "jlif_stop", "jlif_continue", }; -epicsShareDef const char *jlif_key_result_name[5] = { +const char *jlif_key_result_name[5] = { "jlif_key_stop", "jlif_key_continue", "jlif_key_child_inlink", diff --git a/modules/database/src/ioc/db/dbJLink.h b/modules/database/src/ioc/db/dbJLink.h index bd1a6c8a2..fdd4def3e 100644 --- a/modules/database/src/ioc/db/dbJLink.h +++ b/modules/database/src/ioc/db/dbJLink.h @@ -10,7 +10,7 @@ #define INC_dbJLink_H #include -#include +#include #ifdef __cplusplus extern "C" { @@ -124,18 +124,18 @@ typedef struct jlif { */ } jlif; -epicsShareFunc long dbJLinkParse(const char *json, size_t len, short dbfType, +DBCORE_API long dbJLinkParse(const char *json, size_t len, short dbfType, jlink **ppjlink); -epicsShareFunc long dbJLinkInit(struct link *plink); +DBCORE_API long dbJLinkInit(struct link *plink); -epicsShareFunc void dbJLinkFree(jlink *); -epicsShareFunc void dbJLinkReport(jlink *, int level, int indent); +DBCORE_API void dbJLinkFree(jlink *); +DBCORE_API void dbJLinkReport(jlink *, int level, int indent); -epicsShareFunc long dbJLinkMapChildren(struct link *, +DBCORE_API long dbJLinkMapChildren(struct link *, jlink_map_fn rtn, void *ctx); -epicsShareFunc long dbjlr(const char *recname, int level); -epicsShareFunc long dbJLinkMapAll(char *recname, jlink_map_fn rtn, void *ctx); +DBCORE_API long dbjlr(const char *recname, int level); +DBCORE_API long dbJLinkMapAll(char *recname, jlink_map_fn rtn, void *ctx); #ifdef __cplusplus } diff --git a/modules/database/src/std/Makefile b/modules/database/src/std/Makefile index d8eb39bdb..b037b41fb 100644 --- a/modules/database/src/std/Makefile +++ b/modules/database/src/std/Makefile @@ -15,6 +15,9 @@ USR_CPPFLAGS += -DUSE_TYPED_RSET SHRLIB_VERSION = 3.17.0 +API_HEADER = dbRecStdAPI.h +dbRecStd_API = dbRecStd + LIBRARY_IOC += dbRecStd dbRecStd_LIBS = dbCore ca Com diff --git a/modules/libcom/src/Makefile b/modules/libcom/src/Makefile index 57533bafe..f90fde6a6 100644 --- a/modules/libcom/src/Makefile +++ b/modules/libcom/src/Makefile @@ -45,6 +45,10 @@ include $(LIBCOM)/timer/Makefile include $(LIBCOM)/yacc/Makefile include $(LIBCOM)/yajl/Makefile +# Generate library API header file +API_HEADER = libComAPI.h +Com_API = libCom + # Library to build: LIBRARY=Com diff --git a/modules/libcom/src/yajl/yajl.c b/modules/libcom/src/yajl/yajl.c index 6c4977598..02ca188ac 100644 --- a/modules/libcom/src/yajl/yajl.c +++ b/modules/libcom/src/yajl/yajl.c @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "yajl_parse.h" #include "yajl_lex.h" #include "yajl_parser.h" diff --git a/modules/libcom/src/yajl/yajl_alloc.c b/modules/libcom/src/yajl/yajl_alloc.c index 5b2601685..2388814be 100644 --- a/modules/libcom/src/yajl/yajl_alloc.c +++ b/modules/libcom/src/yajl/yajl_alloc.c @@ -22,7 +22,6 @@ #include -#define epicsExportSharedSymbols #include "yajl_alloc.h" static void * yajl_internal_malloc(void *ctx, size_t sz) diff --git a/modules/libcom/src/yajl/yajl_buf.c b/modules/libcom/src/yajl/yajl_buf.c index 0f9c28046..182db7257 100644 --- a/modules/libcom/src/yajl/yajl_buf.c +++ b/modules/libcom/src/yajl/yajl_buf.c @@ -18,7 +18,6 @@ #include #include -#define epicsExportSharedSymbols #include "yajl_buf.h" #define YAJL_BUF_INIT_SIZE 2048 diff --git a/modules/libcom/src/yajl/yajl_common.h b/modules/libcom/src/yajl/yajl_common.h index 4bc63eead..8bf0b44c6 100644 --- a/modules/libcom/src/yajl/yajl_common.h +++ b/modules/libcom/src/yajl/yajl_common.h @@ -18,7 +18,7 @@ #define __YAJL_COMMON_H__ #include -#include +#include #include @@ -42,7 +42,7 @@ extern "C" { #define YAJL_MAX_DEPTH 128 -#define YAJL_API epicsShareFunc +#define YAJL_API LIBCOM_API /** pointer to a malloc function, supporting client overriding memory * allocation routines */ diff --git a/modules/libcom/src/yajl/yajl_encode.c b/modules/libcom/src/yajl/yajl_encode.c index 980021ee5..0aa06a3d6 100644 --- a/modules/libcom/src/yajl/yajl_encode.c +++ b/modules/libcom/src/yajl/yajl_encode.c @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "yajl_encode.h" static void CharToHex(unsigned char c, char * hexBuf) diff --git a/modules/libcom/src/yajl/yajl_gen.c b/modules/libcom/src/yajl/yajl_gen.c index 7f669247d..0727e9fc1 100644 --- a/modules/libcom/src/yajl/yajl_gen.c +++ b/modules/libcom/src/yajl/yajl_gen.c @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsMath.h" #include "yajl_gen.h" #include "yajl_buf.h" diff --git a/modules/libcom/src/yajl/yajl_lex.c b/modules/libcom/src/yajl/yajl_lex.c index 0159cfa55..b911da678 100644 --- a/modules/libcom/src/yajl/yajl_lex.c +++ b/modules/libcom/src/yajl/yajl_lex.c @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "yajl_lex.h" #include "yajl_buf.h" diff --git a/modules/libcom/src/yajl/yajl_parser.c b/modules/libcom/src/yajl/yajl_parser.c index 7e4da6924..cb910f79d 100644 --- a/modules/libcom/src/yajl/yajl_parser.c +++ b/modules/libcom/src/yajl/yajl_parser.c @@ -23,7 +23,6 @@ #include #include -#define epicsExportSharedSymbols #include "yajl_parse.h" #include "yajl_lex.h" #include "yajl_parser.h"