Opened 16 months ago

Closed 7 months ago

#13192 closed Bugs (obsolete)

DLL BOOST_DLL_ALIAS does not compile with Intel C++

Reported by: oley@… Owned by:
Milestone: To Be Determined Component: None
Version: Boost 1.66.0 Severity: Problem
Keywords: Cc: oley@…

Description

The problem is similar to #12290, which was fixed in:

Fix aliases on Windows+IntelCompiler? (trac 12290):

-#if BOOST_COMP_MSVC
+#if BOOST_COMP_MSVC || (BOOST_COMP_INTEL && BOOST_OS_WINDOWS)

I have Intel® Parallel Studio XE 2017 Update 4 (2017.4.120) integrated with MS Visual Studio 2017 Enterprise Update 3 (15.3.3) and the compiler detection in intel.h:

#ifdef BOOST_COMP_INTEL_DETECTION
#   if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED)
#       define BOOST_COMP_INTEL_EMULATED BOOST_COMP_INTEL_DETECTION
#   else
#       undef BOOST_COMP_INTEL
#       define BOOST_COMP_INTEL BOOST_COMP_INTEL_DETECTION
#   endif
#   define BOOST_COMP_INTEL_AVAILABLE
#   include <boost/predef/detail/comp_detected.h>
#endif

defines:

BOOST_COMP_INTEL_EMULATED <= BOOST_COMP_INTEL_DETECTION

BOOST_COMP_INTEL <= BOOST_VERSION_NUMBER_NOT_AVAILABLE

This causes the BOOST_DLL_SECTION to be incorrectly defined.

Change History (3)

comment:1 Changed 16 months ago by anonymous

Version: Boost 1.63.0Boost 1.65.0

comment:2 Changed 10 months ago by Przemyslaw Olejniczak <oley@…>

Cc: oley@… added
Version: Boost 1.65.0Boost 1.66.0

This issue still exists in 1.66.0 compiled on Windows with Intel C++18. This code does not compile:

#include <memory>

#include <boost/dll/alias.hpp>
#include <boost/dll/shared_library.hpp>

using namespace std;

struct Plugin
{
    static shared_ptr<Plugin> create()
    {
        return make_shared<Plugin>();
    }
};

BOOST_DLL_ALIAS(
    Plugin::create,
    CreatePlugin
)

int main()
{
    return 0;
}

with an error:

1>BoostDLL.cpp
1>Info: Boost.Config is older than your compiler version - probably nothing bad will happen - but you may wish to look for an update Boost version.  Define BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE to suppress this message.
1>BoostDLL.cpp(21): error #77: this declaration has no storage class or type specifier
1>  BOOST_DLL_ALIAS(
1>  ^
1>
1>BoostDLL.cpp(21): error : identifier "section" is undefined
1>  BOOST_DLL_ALIAS(
1>  ^
1>
1>BoostDLL.cpp(21): error : expected a ";"
1>  BOOST_DLL_ALIAS(
1>  ^
1>
1>compilation aborted for BoostDLL.cpp (code 2)

comment:3 Changed 7 months ago by John Maddock

Resolution: obsolete
Status: newclosed
Note: See TracTickets for help on using tickets.