EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: epicsExportShared symbols
From: Mark Rivers via Core-talk <core-talk at aps.anl.gov>
To: 'Michael Davidsaver' <mdavidsaver at gmail.com>, "Johnson, Andrew N." <anj at anl.gov>
Cc: "core-talk at aps.anl.gov" <core-talk at aps.anl.gov>
Date: Tue, 11 Aug 2020 15:53:25 +0000
Hi Michael,

> For a support module, you might be better to start looking at the pva2pva module, which is where I tried the idea before changing Base.

#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

I guess the disadvantage of doing it this way, at least prior to 7.0.4 is that the logic is contained in every header file.  If, for example, something needs to be done differently for __GNUC__ > 9 then all of the header files need to change.

Mark



-----Original Message-----
From: Michael Davidsaver <mdavidsaver at gmail.com> 
Sent: Tuesday, August 11, 2020 9:29 AM
To: Mark Rivers <rivers at cars.uchicago.edu>; Johnson, Andrew N. <anj at anl.gov>
Cc: core-talk at aps.anl.gov
Subject: Re: epicsExportShared symbols

On 8/11/20 6:18 AM, Mark Rivers via Core-talk wrote:
> Hi Andrew,
> 
> 
> I am trying to figure out the best way to clean up my code (asyn, areaDetector, etc.) to handle the __declspec DLL_EXPORT/IMPORT stuff.
> 
> 
> I posted a comment to this thread in ADCore about it just now:
> 
> https://github.com/areaDetector/ADCore/issues/455#issuecomment-6719337
> 86
> 
> 
> It looks like EPICS base 7.0.4 has 2 ways of doing it, for example using LIBCOM_API/LIBCA_API, or the more traditional epicsShareFunc and epicsExportSharedSymbols (e.g. in pvAccess).
> 
> 
> I did a "git grep LIBCOM_API" and I cannot actually figure out where LIBCOM_API is defined and how that mechanism works.  Can you explain?
> 
> 
> Does the LIBCA_API mechanism rely on anything in base 7, or can it be used with older versions of base?

Since the _API macros are my initiative, I'll answer this one.
For a support module, you might be better to start looking at the pva2pva module, which is where I tried the idea before changing Base.

https://github.com/epics-base/pva2pva/blob/master/pdbApp/pv/qsrv.h#L21-L37

With Base 7.0.4, this sort of header is generated by makeAPIheader.pl to avoid repetition.  This did involve some Makefile changes to account for dependency issues with use of a generated header by basically every object file.

https://github.com/epics-base/epics-base/blob/7.0/src/tools/makeAPIheader.pl

Replies:
Re: epicsExportShared symbols Michael Davidsaver via Core-talk
References:
epicsExportShared symbols Mark Rivers via Core-talk
Re: epicsExportShared symbols Michael Davidsaver via Core-talk

Navigate by Date:
Prev: Re: AW: Crash in EPICS 7 at iocInit Michael Davidsaver via Core-talk
Next: Re: epicsExportShared symbols Michael Davidsaver via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: epicsExportShared symbols Michael Davidsaver via Core-talk
Next: Re: epicsExportShared symbols Michael Davidsaver via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 11 Aug 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·