Opened 5 years ago

Closed 4 years 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 by anonymous, 5 years ago

Version: Boost 1.63.0Boost 1.65.0

comment:2 by Przemyslaw Olejniczak <oley@…>, 5 years ago

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 by John Maddock, 4 years ago

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