Skip to content

Commit 62c36e9

Browse files
[SYCL] Finally fix iostream_proxy.hpp (#6517)
When _MT and _DLL are both defined, the user has passed /MD or /MDd and is dynamically linking in the runtimes. Because std::cout etc are data, they need to be marked dllimport in that case or else the linker cannot find them.
1 parent 433ea5c commit 62c36e9

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

sycl/include/sycl/detail/iostream_proxy.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
#include <ostream>
44

55
namespace std {
6-
#ifdef _WIN32
6+
#if defined(_MT) && defined(_DLL)
77
#define __SYCL_EXTERN_STREAM_ATTRS __declspec(dllimport)
88
#else
99
#define __SYCL_EXTERN_STREAM_ATTRS
10-
#endif // _WIN32
10+
#endif // defined(_MT) && defined(_DLL)
11+
1112
/// Linked to standard input
1213
extern __SYCL_EXTERN_STREAM_ATTRS istream cin;
1314
/// Linked to standard output

sycl/test/regression/fsycl-host-compiler-win.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414

1515
#include <sycl/sycl.hpp>
1616

17-
// FIXME: Modify <sycl/details/iostream_proxy.hpp> so that it would require
18-
// proper libs via "#pragma comment(lib, ...)".
19-
#include <iostream>
20-
2117
#ifndef DEFINE_CHECK
2218
#error predefined macro not set
2319
#endif // DEFINE_CHECK

0 commit comments

Comments
 (0)