22
22
__SYCL_INLINE_NAMESPACE (cl) {
23
23
namespace sycl {
24
24
25
- #if defined(_WIN32) && !defined(__SYCL_DEVICE_ONLY__)
26
- namespace detail {
25
+ #if defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__)
27
26
// SYCL library is designed such a way that STL objects cross DLL boundary,
28
- // which is not guaranteed to work and considered not safe in general.
29
- // Only using same dynamic C++ runtime library for sycl[d].dll and for
30
- // the application using sycl[d].dll is guaranteed to work properly.
31
- constexpr bool isMSVCDynamicCXXRuntime () {
27
+ // which is guaranteed to work properly only when the application uses the same
28
+ // C++ runtime that SYCL library uses.
29
+ // The appplications using sycl.dll must be linked with dynamic/release C++ MSVC
30
+ // runtime, i.e. be compiled with /MD switch. Similarly, the applications using
31
+ // sycld.dll must be linked with dynamic/debug C++ runtime and be compiled with
32
+ // /MDd switch.
33
+ // Compiler automatically adds /MD or /MDd when -fsycl switch is used.
32
34
// The options /MD and /MDd that make the code to use dynamic runtime also
33
35
// define the _DLL macro.
34
- #ifdef _DLL
35
- return true ;
36
+ #if defined(_MSC_VER)
37
+ #pragma message( \
38
+ " SYCL library is designed to work safely with dynamic C++ runtime." \
39
+ " Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, " \
40
+ " or -fsycl switch to set C++ runtime automatically." )
36
41
#else
37
- return false ;
42
+ #warning "SYCL library is designed to work safely with dynamic C++ runtime."\
43
+ " Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, " \
44
+ " or -fsycl switch to set C++ runtime automatically."
38
45
#endif
39
- }
40
- static_assert (isMSVCDynamicCXXRuntime(),
41
- " SYCL library is designed to work with dynamic C++ runtime, "
42
- " please use /MD or /MDd switches." );
43
- } // namespace detail
44
- #endif // defined(_WIN32) && !defined(__SYCL_DEVICE_ONLY__)
46
+ #endif // defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__)
45
47
46
48
template <class T , class Alloc = std::allocator<T>>
47
49
using vector_class = std::vector<T, Alloc>;
@@ -68,6 +70,5 @@ unique_ptr_class<T> make_unique_ptr(ArgsT &&... Args) {
68
70
return unique_ptr_class<T>(new T (std::forward<ArgsT>(Args)...));
69
71
}
70
72
71
- } // sycl
72
- } // cl
73
-
73
+ } // namespace sycl
74
+ } // __SYCL_INLINE_NAMESPACE(cl)
0 commit comments