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  2015  2016  <20172018  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  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: EPICS V4 Windows build warning messages.
From: Mark Rivers <[email protected]>
To: "'Mark S. Engbretson'" <[email protected]>, "[email protected]" <[email protected]>
Date: Wed, 19 Apr 2017 20:45:55 +0000

Hi Mark,

 

Those warnings are not limited to the EPICS V4 code.  They occur even for very simple C++ classes that include STL containers.  For example this is the definition of the NDAttribute class in ADCore:

 

class epicsShareClass NDAttribute {

public:

    /* Methods */

    NDAttribute(const char *pName, const char *pDescription,

                NDAttrSource_t sourceType, const char *pSource, NDAttrDataType_t dataType, void *pValue);

    NDAttribute(NDAttribute& attribute);

    static const char *attrSourceString(NDAttrSource_t type);

    virtual ~NDAttribute();

    virtual NDAttribute* copy(NDAttribute *pAttribute);

    virtual const char *getName();

    virtual const char *getDescription();

    virtual const char *getSource();

    virtual const char *getSourceInfo(NDAttrSource_t *pSourceType);

    virtual NDAttrDataType_t getDataType();

    virtual int getValueInfo(NDAttrDataType_t *pDataType, size_t *pDataSize);

    virtual int getValue(NDAttrDataType_t dataType, void *pValue, size_t dataSize=0);

    virtual int getValue(std::string& value);

    virtual int setDataType(NDAttrDataType_t dataType);

    virtual int setValue(const void *pValue);

    virtual int setValue(const std::string&);

    virtual int updateValue();

    virtual int report(FILE *fp, int details);

    friend class NDArray;

    friend class NDAttributeList;

 

private:

    template <typename epicsType> int getValueT(void *pValue, size_t dataSize);

    std::string name_;              /**< Name string */

    std::string description_;       /**< Description string */

    NDAttrDataType_t dataType_;     /**< Data type of attribute */

    NDAttrValue value_;             /**< Value of attribute except for strings */

    std::string string_;            /**< Value of attribute for strings */

    std::string source_;            /**< Source string - EPICS PV name or DRV_INFO string */

    NDAttrSource_t sourceType_;     /**< Source type */

    std::string sourceTypeString_;  /**< Source type string */

    NDAttributeListNode listNode_;  /**< Used for NDAttributeList */

};

 

Note that it has some private member data of type std::string.

 

This is what happens when linking dynamically (i.e. EPICS_HOST_ARCH=windows-x64) with the ADSrc library that contains that class on VS2010.

 

************************************************************

j:\epics\devel\areadetector-2-6\adcore\include\NDAttribute.h(115) : warning C4251: 'NDAttribute::name_' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'NDAttribute'

        with

        [

            _Elem=char,

            _Traits=std::char_traits<char>,

            _Ax=std::allocator<char>

        ]

j:\epics\devel\areadetector-2-6\adcore\include\NDAttribute.h(116) : warning C4251: 'NDAttribute::description_' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'NDAttribute'

        with

        [

            _Elem=char,

            _Traits=std::char_traits<char>,

            _Ax=std::allocator<char>

        ]

j:\epics\devel\areadetector-2-6\adcore\include\NDAttribute.h(119) : warning C4251: 'NDAttribute::string_' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'NDAttribute'

        with

        [

            _Elem=char,

            _Traits=std::char_traits<char>,

            _Ax=std::allocator<char>

        ]

j:\epics\devel\areadetector-2-6\adcore\include\NDAttribute.h(120) : warning C4251: 'NDAttribute::source_' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'NDAttribute'

        with

        [

            _Elem=char,

            _Traits=std::char_traits<char>,

            _Ax=std::allocator<char>

        ]

j:\epics\devel\areadetector-2-6\adcore\include\NDAttribute.h(122) : warning C4251: 'NDAttribute::sourceTypeString_' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'NDAttribute'

        with

        [

            _Elem=char,

            _Traits=std::char_traits<char>,

            _Ax=std::allocator<char>

        ]

************************************************************

 

However, those warnings do not occur when building the library statically, i.e. EPICS_HOST_ARCH=windows-x64-static.

 

Mark

 

From: [email protected] [mailto:[email protected]] On Behalf Of Mark S. Engbretson
Sent: Wednesday, April 19, 2017 1:41 PM
To: [email protected]
Subject: EPICS V4 Windows build warning messages.

 

If one builds Epics V 4 on a windows box with Visual Studio 2013 Community, as either shared libraries or static, you get *hundreds* of warning messages that deal with <something> needing to have dll-interface to be used.

 

i.e.

warning C4251: 'epics::nt::NTEnum::URI' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'

needs to have dll-interface to be used by clients of class 'epics::nt::NTEnum'

 

Does anyone know if this is actually an indication that things will most likely not work if, for example, one were to build AD2-6 with Epics V4 support?

 

Microsoft claims that the error is thrown when one is not separating the interface from the implementation. If clients should not be able to access these items, they should be made private and #pragma warning disable C4251 added to source. If they should be accessible, code added to access them.

 

I’m assuming the #pragma solution is a reasonable solution?

 


References:
EPICS V4 Windows build warning messages. Mark S. Engbretson

Navigate by Date:
Prev: RE: EPICS V4 Windows build warning messages. Mark S. Engbretson
Next: ioc epics Al Baradan, Suraka
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: EPICS V4 Windows build warning messages. Andrew Johnson
Next: ioc epics Al Baradan, Suraka
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
ANJ, 21 Dec 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·