|
22 | 22 | __SYCL_INLINE_NAMESPACE(cl) {
|
23 | 23 | namespace sycl {
|
24 | 24 |
|
25 |
| - template < class T, class Alloc = std::allocator<T> > |
26 |
| - using vector_class = std::vector<T, Alloc>; |
27 |
| - |
28 |
| - using string_class = std::string; |
29 |
| - |
30 |
| - template <class Sig> |
31 |
| - using function_class = std::function<Sig>; |
32 |
| - |
33 |
| - using mutex_class = std::mutex; |
34 |
| - |
35 |
| - template <class T, class Deleter = std::default_delete<T>> |
36 |
| - using unique_ptr_class = std::unique_ptr<T, Deleter>; |
37 |
| - |
38 |
| - template <class T> |
39 |
| - using shared_ptr_class = std::shared_ptr<T>; |
40 |
| - |
41 |
| - template <class T> |
42 |
| - using weak_ptr_class = std::weak_ptr<T>; |
43 |
| - |
44 |
| - template <class T> |
45 |
| - using hash_class = std::hash<T>; |
46 |
| - |
47 |
| - using exception_ptr_class = std::exception_ptr; |
48 |
| - |
49 |
| - template <typename T, typename... ArgsT> |
50 |
| - unique_ptr_class<T> make_unique_ptr(ArgsT &&... Args) { |
51 |
| - return unique_ptr_class<T>(new T(std::forward<ArgsT>(Args)...)); |
52 |
| - } |
53 |
| -} // sycl |
54 |
| -} // cl |
55 |
| - |
| 25 | +#if defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__) |
| 26 | +// SYCL library is designed such a way that STL objects cross DLL boundary, |
| 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. |
| 34 | +// The options /MD and /MDd that make the code to use dynamic runtime also |
| 35 | +// define the _DLL macro. |
| 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.") |
| 41 | +#else |
| 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." |
| 45 | +#endif |
| 46 | +#endif // defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__) |
| 47 | + |
| 48 | +template <class T, class Alloc = std::allocator<T>> |
| 49 | +using vector_class = std::vector<T, Alloc>; |
| 50 | + |
| 51 | +using string_class = std::string; |
| 52 | + |
| 53 | +template <class Sig> using function_class = std::function<Sig>; |
| 54 | + |
| 55 | +using mutex_class = std::mutex; |
| 56 | + |
| 57 | +template <class T, class Deleter = std::default_delete<T>> |
| 58 | +using unique_ptr_class = std::unique_ptr<T, Deleter>; |
| 59 | + |
| 60 | +template <class T> using shared_ptr_class = std::shared_ptr<T>; |
| 61 | + |
| 62 | +template <class T> using weak_ptr_class = std::weak_ptr<T>; |
| 63 | + |
| 64 | +template <class T> using hash_class = std::hash<T>; |
| 65 | + |
| 66 | +using exception_ptr_class = std::exception_ptr; |
| 67 | + |
| 68 | +template <typename T, typename... ArgsT> |
| 69 | +unique_ptr_class<T> make_unique_ptr(ArgsT &&... Args) { |
| 70 | + return unique_ptr_class<T>(new T(std::forward<ArgsT>(Args)...)); |
| 71 | +} |
| 72 | + |
| 73 | +} // namespace sycl |
| 74 | +} // __SYCL_INLINE_NAMESPACE(cl) |
0 commit comments