Experimental Physics and Industrial Control System
> 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.
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
- Replies:
- Re: epicsExport.h on Windows Michael Davidsaver
- References:
- epicsExport.h on Windows Ralph Lange
- Re: epicsExport.h on Windows Michael Davidsaver
- Navigate by Date:
- Prev:
RE: epicsExport.h on Windows Mark Rivers
- Next:
Re: epicsExport.h on Windows Michael Davidsaver
- 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 Michael Davidsaver
- Next:
Re: epicsExport.h on Windows Michael Davidsaver
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
<2017>
2018
2019
2020
2021
2022
2023
2024