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  <20192020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: CALLBACK clash
From: Benjamin Franksen via Core-talk <[email protected]>
Cc: EPICS core-talk <[email protected]>
Date: Wed, 18 Sep 2019 15:47:23 +0200
Am 05.09.19 um 16:45 schrieb Michael Davidsaver via Core-talk:
> On 9/5/19 2:26 AM, Johnson, Andrew N. wrote:
>> The callback.h header contains this:
>>
>>> /*
>>>  * WINDOWS also has a "CALLBACK" type def
>>>  */
>>> #ifdef _WIN32
>>> #       ifdef CALLBACK
>>> #               undef CALLBACK
>>> #       endif /*CALLBACK*/
>>> #endif /*_WIN32*/
>>
>> I think that was set up so that as long as you include the clashing windows header first (and don’t need to use their CALLBACK facilities) you should be able to include callback.h afterwards and it will hide the Windows definition.
>>
> 
> Sadly, not.  I know this is an ordering issue.  What I
> don't know __where__ the issue comes from as the MSVC
> error output doesn't mention any line numbers in pdbsingle.cpp.
> 
> I'm also unable to find where (all) the windows headers
> define CALLBACK.  A (case insensitive) google search
> finds a lot of unrelated chatter about callback functions.
> The mingw headers define CALLBACK in a half dozen different
> headers.

Another trick to avoid name clashes is to rename the symbol:

#define CALLBACK EPICS_CALLBACK
typedef struct whatever CALLBACK;

The idea is that anything that uses CALLBACK would have to include
callback.h and thus in the module that includes it we redefine it to
EPICS_CALLBACK. This requires that system headers are included last.

One can also rename the windows CALLBACK as in

#define CALLBACK WINDOWS_CALLBACK
#include <windows.h>
#undef CALLBACK

Cheers
Ben

Attachment: signature.asc
Description: OpenPGP digital signature


References:
CALLBACK clash Michael Davidsaver via Core-talk
Re: CALLBACK clash Johnson, Andrew N. via Core-talk
Re: CALLBACK clash Michael Davidsaver via Core-talk

Navigate by Date:
Prev: [Bug 1844537] [NEW] OMSL doesn't work with constant DOL Ben Franksen via Core-talk
Next: [Merge] ~dirk.zimoch/epics-base:iocLogClientFixes into epics-base:7.0 Dirk Zimoch via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: CALLBACK clash Michael Davidsaver via Core-talk
Next: Build failed in Jenkins: epics-example-vx68 #409 APS Jenkins via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
ANJ, 18 Sep 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·