EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: seq-2.1.12 and C++
From: Benjamin Franksen <[email protected]>
To: <[email protected]>
Date: Mon, 31 Aug 2015 12:01:42 +0200
On Monday 24 August 2015 14:26:12 Hovanes Egiyan wrote:
> Hi,
>
> I was trying to call SNLs C-functions equivalents for pvPut, pvGet,
> pvAssign etc (seq_pvPut ...)
> from a C++ code using seq-2.1.12, and run into a compile-time problem.
> I was getting error messages from g++:
>
> /gluex/controls/epics/R3-14-12-3-RHEL5/support/seq-2.1.12/include/seqC
> om.h:102: error: conflicting declaration ‘typedef const struct seqChan
> seqChan’
> /gluex/controls/epics/R3-14-12-3-RHEL5/support/seq-2.1.12/include/seq
> Com.h:102: error: ‘struct seqChan’ has a previous declaration as
> ‘struct seqChan’
> /gluex/controls/epics/R3-14-12-3-RHEL5/support/seq-2.1.12/include/seq
> Com.h:103: error: conflicting declaration ‘typedef const struct
> seqState seqState’
> /gluex/controls/epics/R3-14-12-3-RHEL5/support/seq-2.1.12/include/seq
> Com.h:103: error: ‘struct seqState’ has a previous declaration as
> ‘struct seqState’
> /gluex/controls/epics/R3-14-12-3-RHEL5/support/seq-2.1.12/include/seq
> Com.h:104: error: conflicting declaration ‘typedef const struct seqSS
> seqSS’
> /gluex/controls/epics/R3-14-12-3-RHEL5/support/seq-2.1.12/include/seq
> Com.h:104: error: ‘struct seqSS’ has a previous declaration as ‘struct
> seqSS’
>
> The problem seems to be coming from seq-2.1.12/src/seq/seqCom.h header
> file where there are typedef
> statements for struct structure before actual definition of the
> structures. C++ does not
> seem to like it, and I was able to move forward using one "#ifndef
> __cplusplus" instruction :
>
> #ifndef __cplusplus
> typedef const struct seqChan seqChan;
> typedef const struct seqState seqState;
> typedef const struct seqSS seqSS;
> typedef struct seqProgram seqProgram;
> #endif
>
> /* Static information about a channel */
> struct seqChan
> {
> ...
>
> That way these typedefs are not be present for a C++ compiler.
> I do not know if it breaks anything in the bigger picture,

Well, the typedefs in question have a 'const' in them, so there is a
semantic difference. The better solution would be to rename either the
typedefs or the struct names.

> but if it
> does not, may be it could
> be included in the "src/seq/seqCom.h" for the seq module.

I am reluctant to make this change on the 2.1 branch because there is no
longer any development happening there except critical bug fixes. The
problem should not appear with version 2.2, where I have separated the
definitions that are (meant to be) used only by the generated C code
(including the 'typedef const struct xxx' definitions that are causing
your problem) into a separate header file.

So, unless there is strong demand for it, I'd rather point you to
version 2.2 if you need to call pv functions from C++.

Cheers
Ben

________________________________

Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin

http://www.helmholtz-berlin.de


Replies:
Re: seq-2.1.12 and C++ Wesley Moore
Re: seq-2.1.12 and C++ Hovanes Egiyan
References:
seq-2.1.12 and C++ Hovanes Egiyan

Navigate by Date:
Prev: Re: AW: Records for slow control Ralph Lange
Next: where to download CCS Boy? Petro Kazmirchuk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: seq-2.1.12 and C++ Hovanes Egiyan
Next: Re: seq-2.1.12 and C++ Wesley Moore
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·