replace shareLib.h with QSRV_API

and hopefully avoid at least some of the maddening
include order bugs so common with sharedLib.h.
This commit is contained in:
Michael Davidsaver
2019-09-05 20:01:56 -07:00
parent 2e58e54e1d
commit bdbf57350b
20 changed files with 49 additions and 58 deletions

View File

@ -16,6 +16,7 @@ LIBRARY += qsrv
SHRLIB_VERSION ?= $(EPICS_QSRV_ABI_MAJOR_VERSION).$(EPICS_QSRV_ABI_MINOR_VERSION)
USR_CPPFLAGS += -DQSRV_API_BUILDING
USR_CPPFLAGS += -I$(TOP)/common -I$(TOP)/p2pApp
INC += pv/qsrv.h

View File

@ -14,7 +14,6 @@
#include <pv/configuration.h>
#include <pv/json.h>
#define epicsExportSharedSymbols
#include "pdbgroup.h"
namespace {

View File

@ -13,7 +13,6 @@
#include <pv/pvData.h>
#include <pv/anyscalar.h>
#define epicsExportSharedSymbols
#include "pvif.h"
namespace pvd = epics::pvData;

View File

@ -19,7 +19,6 @@
#include <pv/pvAccess.h>
#include <pv/configuration.h>
#define epicsExportSharedSymbols
#include "helper.h"
#include "pdbsingle.h"
#include "pvif.h"

View File

@ -30,7 +30,7 @@ struct PDBPV
virtual void show(int lvl) {}
};
struct epicsShareClass PDBProvider : public epics::pvAccess::ChannelProvider,
struct QSRV_API PDBProvider : public epics::pvAccess::ChannelProvider,
public epics::pvAccess::ChannelFind,
public std::tr1::enable_shared_from_this<PDBProvider>
{
@ -67,7 +67,7 @@ struct epicsShareClass PDBProvider : public epics::pvAccess::ChannelProvider,
static size_t num_instances;
};
epicsShareFunc
QSRV_API
void QSRVRegistrar_counters();
#endif // PDB_H

View File

@ -13,7 +13,6 @@
#include <pv/configuration.h>
#include <pv/epicsException.h>
#define epicsExportSharedSymbols
#include "helper.h"
#include "pdbgroup.h"
#include "pdb.h"

View File

@ -19,9 +19,9 @@
#include <shareLib.h>
struct epicsShareClass GroupConfig
struct QSRV_API GroupConfig
{
struct epicsShareClass Field {
struct QSRV_API Field {
std::string type, channel, trigger, id;
int putorder;
@ -36,7 +36,7 @@ struct epicsShareClass GroupConfig
}
};
struct epicsShareClass Group {
struct QSRV_API Group {
typedef std::map<std::string, Field> fields_t;
fields_t fields;
bool atomic, atomic_set;
@ -70,7 +70,7 @@ struct PDBGroupMonitor;
void pdb_group_event(void *user_arg, struct dbChannel *chan,
int eventsRemaining, struct db_field_log *pfl);
struct epicsShareClass PDBGroupPV : public PDBPV
struct QSRV_API PDBGroupPV : public PDBPV
{
POINTER_DEFINITIONS(PDBGroupPV);
weak_pointer weakself;
@ -133,7 +133,7 @@ struct epicsShareClass PDBGroupPV : public PDBPV
virtual void show(int lvl) OVERRIDE;
};
struct epicsShareClass PDBGroupChannel : public BaseChannel,
struct QSRV_API PDBGroupChannel : public BaseChannel,
public std::tr1::enable_shared_from_this<PDBGroupChannel>
{
POINTER_DEFINITIONS(PDBGroupChannel);

View File

@ -15,7 +15,6 @@
#include <pv/security.h>
#include <pv/configuration.h>
#define epicsExportSharedSymbols
#include "helper.h"
#include "pdbsingle.h"
#include "pdb.h"

View File

@ -20,7 +20,7 @@
struct PDBSingleMonitor;
struct epicsShareClass PDBSinglePV : public PDBPV
struct QSRV_API PDBSinglePV : public PDBPV
{
POINTER_DEFINITIONS(PDBSinglePV);
weak_pointer weakself;

View File

@ -2,7 +2,6 @@
#define PV_QSRV_H
#include <epicsVersion.h>
#include <shareLib.h>
#ifndef VERSION_INT
# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P))
@ -15,6 +14,29 @@
#define QSRV_ABI_VERSION_INT VERSION_INT(EPICS_QSRV_ABI_MAJOR_VERSION, EPICS_QSRV_ABI_MINOR_VERSION, 0, 0)
#if defined(QSRV_API_BUILDING) && defined(epicsExportSharedSymbols)
# error Use QSRV_API or shareLib.h not both
#endif
#if defined(_WIN32) || defined(__CYGWIN__)
# if defined(QSRV_API_BUILDING) && defined(EPICS_BUILD_DLL)
/* building library as dll */
# define QSRV_API __declspec(dllexport)
# elif !defined(QSRV_API_BUILDING) && defined(EPICS_CALL_DLL)
/* calling library in dll form */
# define QSRV_API __declspec(dllimport)
# endif
#elif __GNUC__ >= 4
# define QSRV_API __attribute__ ((visibility("default")))
#endif
#ifndef QSRV_API
# define QSRV_API
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -22,12 +44,12 @@ extern "C" {
struct link; /* aka. DBLINK from link.h */
/** returns QSRV_VERSION_INT captured at compilation time */
epicsShareExtern unsigned qsrvVersion(void);
QSRV_API unsigned qsrvVersion(void);
/** returns QSRV_ABI_VERSION_INT captured at compilation time */
epicsShareExtern unsigned qsrvABIVersion(void);
QSRV_API unsigned qsrvABIVersion(void);
epicsShareFunc void testqsrvWaitForLinkEvent(struct link *plink);
QSRV_API void testqsrvWaitForLinkEvent(struct link *plink);
/** Call before testIocShutdownOk()
@code
@ -41,7 +63,7 @@ epicsShareFunc void testqsrvWaitForLinkEvent(struct link *plink);
testdbCleanup();
@endcode
*/
epicsShareExtern void testqsrvShutdownOk(void);
QSRV_API void testqsrvShutdownOk(void);
/** Call after testIocShutdownOk() and before testdbCleanup()
@code
@ -55,7 +77,7 @@ epicsShareExtern void testqsrvShutdownOk(void);
testdbCleanup();
@endcode
*/
epicsShareExtern void testqsrvCleanup(void);
QSRV_API void testqsrvCleanup(void);
#ifdef __cplusplus
}

View File

@ -26,13 +26,12 @@
#include <pv/reftrack.h>
#include <pva/client.h>
#include <epicsExport.h> /* defines epicsExportSharedSymbols */
#include "pv/qsrv.h"
#include "helper.h"
#include "pvif.h"
#include "pvalink.h"
#include <epicsExport.h> /* defines epicsExportSharedSymbols */
int pvaLinkDebug;
int pvaLinkIsolate;

View File

@ -4,11 +4,6 @@
#include <set>
#include <map>
#ifdef epicsExportSharedSymbols
# define pvalinkEpicsExportSharedSymbols
# undef epicsExportSharedSymbols
#endif
#define EPICS_DBCA_PRIVATE_API
#include <epicsGuard.h>
#include <dbAccess.h>
@ -44,19 +39,14 @@
#include <pv/sharedPtr.h>
#ifdef pvalinkEpicsExportSharedSymbols
# define epicsExportSharedSymbols
# undef pvalinkEpicsExportSharedSymbols
#endif
#include "helper.h"
#include "pvif.h"
#include "tpool.h"
extern "C" {
epicsShareExtern int pvaLinkDebug;
epicsShareExtern int pvaLinkIsolate;
epicsShareExtern int pvaLinkNWorkers;
QSRV_API extern int pvaLinkDebug;
QSRV_API extern int pvaLinkIsolate;
QSRV_API extern int pvaLinkNWorkers;
}
#if 0

View File

@ -3,9 +3,6 @@
#include <pv/reftrack.h>
#define epicsExportSharedSymbols
#include <shareLib.h>
#include "pvalink.h"
int pvaLinkNWorkers = 1;

View File

@ -2,9 +2,6 @@
#include <epicsStdio.h> // redirects stdout/stderr
#define epicsExportSharedSymbols
#include <shareLib.h>
#include "pvalink.h"
namespace pvalink {

View File

@ -1,9 +1,6 @@
#include <pv/reftrack.h>
#include <alarm.h>
#define epicsExportSharedSymbols
#include <shareLib.h>
#include "pvalink.h"
namespace pvalink {

View File

@ -6,9 +6,6 @@
#include <pv/current_function.h>
#define epicsExportSharedSymbols
#include <shareLib.h>
#include "pvalink.h"

View File

@ -22,7 +22,6 @@
#include <pv/pvAccess.h>
#include <pv/security.h>
#define epicsExportSharedSymbols
#include "sb.h"
#include "pvif.h"

View File

@ -16,7 +16,7 @@
#include <pv/pvData.h>
#include <pv/anyscalar.h>
#include <shareLib.h>
#include <pv/qsrv.h>
#ifndef VERSION_INT
# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P))
@ -39,11 +39,11 @@ class ChannelRequester;
short PVD2DBR(epics::pvData::ScalarType pvt);
// copy from PVField (.value sub-field) to DBF buffer
epicsShareExtern
QSRV_API
long copyPVD2DBF(const epics::pvData::PVField::const_shared_pointer& in,
void *outbuf, short outdbf, long *outnReq);
// copy from DBF buffer to PVField (.value sub-field)
epicsShareExtern
QSRV_API
long copyDBF2PVD(const epics::pvData::shared_vector<const void>& buf,
const epics::pvData::PVField::shared_pointer& out,
epics::pvData::BitSet &changed,
@ -69,7 +69,7 @@ union dbrbuf {
char dbf_STRING[MAX_STRING_SIZE];
};
struct epicsShareClass DBCH {
struct QSRV_API DBCH {
dbChannel *chan;
DBCH() :chan(0) {}
explicit DBCH(dbChannel *ch); // calls dbChannelOpen()
@ -309,7 +309,7 @@ struct DBManyLocker
};
#endif
struct epicsShareClass FieldName
struct QSRV_API FieldName
{
struct Component {
std::string name;
@ -352,7 +352,7 @@ private:
FieldName& operator=(const FieldName&);
};
struct epicsShareClass PVIF {
struct QSRV_API PVIF {
PVIF(dbChannel *ch);
virtual ~PVIF() {}
@ -378,7 +378,7 @@ private:
PVIF& operator=(const PVIF&);
};
struct epicsShareClass PVIFBuilder {
struct QSRV_API PVIFBuilder {
virtual ~PVIFBuilder() {}
@ -402,7 +402,7 @@ private:
PVIFBuilder& operator=(const PVIFBuilder&);
};
struct epicsShareClass ScalarBuilder : public PVIFBuilder
struct QSRV_API ScalarBuilder : public PVIFBuilder
{
virtual ~ScalarBuilder() {}

View File

@ -18,8 +18,6 @@
#include <pv/serverContext.h>
#include <pv/iocshelper.h>
#define epicsExportSharedSymbols
#include "pv/qsrv.h"
#include "pvahelper.h"
#include "pvif.h"

View File

@ -9,7 +9,6 @@
#include <pv/sharedPtr.h>
#define epicsExportSharedSymbols
#include "helper.h"
#include "tpool.h"