On 03/21/2017 09:23 AM, Mark Rivers wrote:
>> extern "C" is always needed for export from C++ due to name mangling. I
>> don't think there is anything windows/msvc specific here.
>
> It links OK without extern "C" on Linux, but not on Windows.
You're right, I see the same at least for gcc 4.9.2. However, I think
this is implementation defined behavior on the part of gcc, which is
choosing in this instance not to mangle variable names.
I would maintain that extern "C" is correct as this will match what is
found in the generated _registerRecordDeviceDriver.cpp
>
> Mark
>
> ________________________________________
> From: [email protected] [[email protected]] on behalf of Michael Davidsaver [[email protected]]
> Sent: Tuesday, March 21, 2017 8:15 AM
> To: Ralph Lange; EPICS Core Talk
> Subject: Re: epicsExport.h on Windows
>
> extern "C" is always needed for export from C++ due to name mangling. I
> don't think there is anything windows/msvc specific here.
>
> The first definition is never used and imo. should be removed.
>
>>> extern statements in epicsExport.h are ignored by VS compiler
>
> They are not ignored. They just don't have the same effect. 'extern'
> and 'extern "C"' behave differently despite using the same keyword.
>
>
> On 03/21/2017 08:16 AM, Ralph Lange wrote:
>> Dear Core-Talkers,
>>
>> For a device support partly written in C++, we have been getting a pull
>> request for Windows builds that adds extern "C" declarations around
>> EPICS exports, e.g.
>>
>> -epicsExportAddress(double, connectInterval);
>> +extern "C" {
>> + epicsExportAddress(double, connectInterval);
>> +}
>>
>>
>> with the comment
>>
>> I am afraid that the extern statements in epicsExport.h are ignored
>> by VS compiler when expanding the epicsRegisterFunction macro.
>> Therefore they need to be repeated here otherwise we get a linking
>> failure when building test IOC.
>>
>>
>> As my Windows experience is very limited - is there a better way to
>> handle that?
>>
>> Thanks,
>> ~Ralph
>
- References:
- epicsExport.h on Windows Ralph Lange
- Re: epicsExport.h on Windows Michael Davidsaver
- RE: epicsExport.h on Windows Mark Rivers
- Navigate by Date:
- Prev:
RE: epicsExport.h on Windows Mark Rivers
- Next:
EPICS R3.15.5 IOC crashes for DBR_CTRL_CHAR request with 1 array element Kasemir, Kay
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
<2017>
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: epicsExport.h on Windows Mark Rivers
- Next:
EPICS R3.15.5 IOC crashes for DBR_CTRL_CHAR request with 1 array element Kasemir, Kay
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
<2017>
2018
2019
2020
2021
2022
2023
2024
|