diff --git a/src/gdd/gdd.cc b/src/gdd/gdd.cc index c0b34d3f3..6233e8136 100644 --- a/src/gdd/gdd.cc +++ b/src/gdd/gdd.cc @@ -30,7 +30,13 @@ gdd_NEWDEL_STAT(gdd) epicsMutex * gdd::pGlobalMutex = 0; epicsThreadOnceId gdd::staticInitOnce = EPICS_THREAD_ONCE_INIT; -void gdd::staticInit ( void * ) +// Can't pass C++ linkage static member function gdd::staticInit +// into epicsThreadOnce(); we need a C linkage function for that: +extern "C" { + static void gdd_staticInit(void *) { gdd::staticInit(); } +} + +void gdd::staticInit (void) { gdd::pGlobalMutex = new epicsMutex; assert ( gdd::pGlobalMutex ); @@ -95,7 +101,7 @@ gdd::gdd(int app, aitEnum prim, int dimen, aitUint32* val) void gdd::init(int app, aitEnum prim, int dimen) { - epicsThreadOnce ( & gdd::staticInitOnce, gdd::staticInit, 0 ); + epicsThreadOnce ( & gdd::staticInitOnce, gdd_staticInit, 0 ); setApplType(app); // diff --git a/src/gdd/gdd.h b/src/gdd/gdd.h index 4de908a35..dee23bb68 100644 --- a/src/gdd/gdd.h +++ b/src/gdd/gdd.h @@ -56,6 +56,10 @@ class gddScalar; struct epicsTimeStamp; struct timespec; +extern "C" { + static void gdd_staticInit(void *); +} + // Not Complete in this prototype: // - Read only DD. // - Small array management using free lists @@ -503,7 +507,8 @@ private: static epicsMutex * pGlobalMutex; static epicsThreadOnceId staticInitOnce; - static void staticInit ( void * ); + static void staticInit (void); +friend void gdd_staticInit(void *); const gdd* indexDD (aitIndex index) const; }; diff --git a/src/gdd/gddNewDel.cc b/src/gdd/gddNewDel.cc index 5943cb966..8cd9c3024 100644 --- a/src/gdd/gddNewDel.cc +++ b/src/gdd/gddNewDel.cc @@ -38,11 +38,14 @@ private: static gddCleanUp * pBufferCleanUpGDD = NULL; static epicsThreadOnceId gddCleanupOnce = EPICS_THREAD_ONCE_INIT; + +extern "C" { static void gddCleanupInit ( void * ) { pBufferCleanUpGDD = new gddCleanUp; assert ( pBufferCleanUpGDD ); } +} void gddGlobalCleanupAdd ( void * pBuf ) { diff --git a/src/gdd/gddNewDel.h b/src/gdd/gddNewDel.h index d15993021..ad18d3a3a 100644 --- a/src/gdd/gddNewDel.h +++ b/src/gdd/gddNewDel.h @@ -62,7 +62,7 @@ void gddGlobalCleanupAdd ( void * pBuf ); void operator delete(void*); \ char* newdel_next(void) { char** x=(char**)&(fld); return *x; } \ void newdel_setNext(char* n) { char** x=(char**)&(fld); *x=n; } \ - static void gddNewDelInit ( void * ) { pNewdel_lock = new epicsMutex; } + static void gddNewDelInit (void) { pNewdel_lock = new epicsMutex; } \ // declaration of the static variable for the free list @@ -87,10 +87,12 @@ void gddGlobalCleanupAdd ( void * pBuf ); // code for the new function #define gdd_NEWDEL_NEW(clas) \ + extern "C" { void clas##_gddNewDelInit ( void * ) { \ + clas::gddNewDelInit(); } } \ void* clas::operator new(size_t size) { \ int tot; \ clas *nn,*dn; \ - epicsThreadOnce ( &once, gddNewDelInit, 0 ); \ + epicsThreadOnce ( &once, clas##_gddNewDelInit, 0 ); \ if(!clas::newdel_freelist) { \ tot=gdd_CHUNK_NUM; \ nn=(clas*)malloc(gdd_CHUNK(clas)); \ diff --git a/src/gdd/gddUtils.h b/src/gdd/gddUtils.h index 2a8a701cd..2636d63a6 100644 --- a/src/gdd/gddUtils.h +++ b/src/gdd/gddUtils.h @@ -93,7 +93,7 @@ public: gddStatus destroy(void* thing_to_remove); virtual void run(void* thing_to_remove); - gdd_NEWDEL_FUNC(arg); // for using generic new and remove + gdd_NEWDEL_FUNC(arg) // for using generic new and remove protected: aitUint16 ref_cnt; void* arg; @@ -114,7 +114,7 @@ class epicsShareClass gddBounds1D public: gddBounds1D(void) { } gddBounds* boundArray(void); - gdd_NEWDEL_FUNC(b[0]); // required for using generic new and remove + gdd_NEWDEL_FUNC(b[0]) // required for using generic new and remove private: gddBounds b[1]; gdd_NEWDEL_DATA // required for using generic new/remove @@ -126,7 +126,7 @@ class epicsShareClass gddBounds2D public: gddBounds2D(void) { } gddBounds* boundArray(void); - gdd_NEWDEL_FUNC(b[0]); // required for using generic new and remove + gdd_NEWDEL_FUNC(b[0]) // required for using generic new and remove private: gddBounds b[2]; gdd_NEWDEL_DATA // required for using generic new/remove @@ -138,7 +138,7 @@ class epicsShareClass gddBounds3D public: gddBounds3D(void) { } gddBounds* boundArray(void); - gdd_NEWDEL_FUNC(b[0]); // for using generic new and remove + gdd_NEWDEL_FUNC(b[0]) // for using generic new and remove private: gddBounds b[3]; gdd_NEWDEL_DATA // required for using generic new/remove diff --git a/src/libCom/osi/os/default/epicsReadline.c b/src/libCom/osi/os/default/epicsReadline.c index dd5a3e9b6..eb7d83b16 100644 --- a/src/libCom/osi/os/default/epicsReadline.c +++ b/src/libCom/osi/os/default/epicsReadline.c @@ -187,6 +187,7 @@ epicsReadlineEnd (void *context) #if defined(vxWorks) +#include #include #define LEDLIB_LINESIZE 1000 diff --git a/src/libCom/osi/os/vxWorks/iocClock.c b/src/libCom/osi/os/vxWorks/iocClock.c index feabf456f..6519d58e2 100644 --- a/src/libCom/osi/os/vxWorks/iocClock.c +++ b/src/libCom/osi/os/vxWorks/iocClock.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "epicsTypes.h" #include "cantProceed.h" diff --git a/src/libCom/osi/os/vxWorks/osdSock.c b/src/libCom/osi/os/vxWorks/osdSock.c index 6638577d9..a21448f76 100644 --- a/src/libCom/osi/os/vxWorks/osdSock.c +++ b/src/libCom/osi/os/vxWorks/osdSock.c @@ -18,6 +18,8 @@ #include #include +#include "errlog.h" + #define epicsExportSharedSymbols #include "osiSock.h"