File tree Expand file tree Collapse file tree 5 files changed +42
-12
lines changed Expand file tree Collapse file tree 5 files changed +42
-12
lines changed Original file line number Diff line number Diff line change 13
13
import Darwin
14
14
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android)
15
15
import Glibc
16
+ #elseif os(Windows)
17
+ import MSVCRT
16
18
#endif
17
19
18
20
let sourcePath = CommandLine . arguments [ 1 ]
Original file line number Diff line number Diff line change @@ -55,10 +55,11 @@ import StdlibUnittest
55
55
56
56
#if os(Linux)
57
57
import Glibc
58
- let dylibSuffix = " so "
58
+ #elseif os(Windows)
59
+ import MSVCRT
60
+ import WinSDK
59
61
#else
60
62
import Darwin
61
- let dylibSuffix = " dylib "
62
63
#endif
63
64
64
65
var DynamicallyReplaceable = TestSuite ( " DynamicallyReplaceable " )
@@ -108,6 +109,16 @@ func checkExpectedResults(forOriginalLibrary useOrig: Bool) {
108
109
expectedResult ( useOrig, " public_enum_generic_func " ) )
109
110
}
110
111
112
+ private func target_library_name( _ name: String ) -> String {
113
+ #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
114
+ return " lib \( name) .dylib "
115
+ #elseif os(Windows)
116
+ return " \( name) .dll "
117
+ #else
118
+ return " lib \( name) .so "
119
+ #endif
120
+ }
121
+
111
122
DynamicallyReplaceable . test ( " DynamicallyReplaceable " ) {
112
123
var executablePath = CommandLine . arguments [ 0 ]
113
124
executablePath. removeLast ( 4 )
@@ -118,9 +129,11 @@ DynamicallyReplaceable.test("DynamicallyReplaceable") {
118
129
// Now, test with the module containing the replacements.
119
130
120
131
#if os(Linux)
121
- _ = dlopen ( " libModule2. " + dylibSuffix, RTLD_NOW)
132
+ _ = dlopen ( target_library_name ( " Module2 " ) , RTLD_NOW)
133
+ #elseif os(Windows)
134
+ _ = LoadLibraryA ( target_library_name ( " Module2 " ) )
122
135
#else
123
- _ = dlopen ( executablePath + " libModule2. " + dylibSuffix , RTLD_NOW)
136
+ _ = dlopen ( target_library_name ( " Module2 " ) , RTLD_NOW)
124
137
#endif
125
138
checkExpectedResults ( forOriginalLibrary: false )
126
139
}
Original file line number Diff line number Diff line change @@ -24,25 +24,38 @@ import StdlibUnittest
24
24
25
25
#if os(Linux)
26
26
import Glibc
27
- let dylibSuffix = " so "
27
+ #elseif os(Windows)
28
+ import MSVCRT
29
+ import WinSDK
28
30
#else
29
31
import Darwin
30
- let dylibSuffix = " dylib "
31
32
#endif
32
33
33
34
var DynamicallyReplaceable = TestSuite ( " DynamicallyReplaceableChaining " )
34
35
36
+ func target_library_name( _ name: String ) -> String {
37
+ #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
38
+ return " lib \( name) .dylib "
39
+ #elseif os(Windows)
40
+ return " \( name) .dll "
41
+ #else
42
+ return " lib \( name) .so "
43
+ #endif
44
+ }
35
45
36
46
DynamicallyReplaceable . test ( " DynamicallyReplaceable " ) {
37
47
var executablePath = CommandLine . arguments [ 0 ]
38
48
executablePath. removeLast ( 4 )
39
49
40
50
#if os(Linux)
41
- _ = dlopen ( " libB. " + dylibSuffix, RTLD_NOW)
42
- _ = dlopen ( " libC. " + dylibSuffix, RTLD_NOW)
51
+ _ = dlopen ( target_library_name ( " B " ) , RTLD_NOW)
52
+ _ = dlopen ( target_library_name ( " C " ) , RTLD_NOW)
53
+ #elseif os(Windows)
54
+ _ = LoadLibraryA ( target_library_name ( " B " ) )
55
+ _ = LoadLibraryA ( target_library_name ( " C " ) )
43
56
#else
44
- _ = dlopen ( executablePath+ " libB. " + dylibSuffix , RTLD_NOW)
45
- _ = dlopen ( executablePath+ " libC. " + dylibSuffix , RTLD_NOW)
57
+ _ = dlopen ( executablePath+ target_library_name ( " B " ) , RTLD_NOW)
58
+ _ = dlopen ( executablePath+ target_library_name ( " C " ) , RTLD_NOW)
46
59
#endif
47
60
48
61
#if CHAINING
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ private struct Expressible
17
17
}
18
18
}
19
19
20
- private func string( _ characters: UInt32 ... ) -> String {
20
+ public func string( _ characters: UInt32 ... ) -> String {
21
21
return String ( characters. map { Character ( UnicodeScalar ( $0) !) } )
22
22
}
23
23
private func expressible< T> ( _ literal: Expressible < T > , as type: T . Type )
Original file line number Diff line number Diff line change 1
- // RUN: %target-build-swift %s -import-objc-header %S/Inputs/unions-and-bitfields.h -disable-bridging-pch -o %t
1
+ // RUN: %target-build-swift %s -Xfrontend -enable-objc-interop -Xfrontend -disable-objc-attr-requires-foundation-module - import-objc-header %S/Inputs/unions-and-bitfields.h -disable-bridging-pch -o %t
2
2
// RUN: %target-codesign %t
3
3
// RUN: %target-run %t
4
+
4
5
// REQUIRES: executable_test
6
+ // REQUIRES: objc_interop
5
7
6
8
// The -disable-bridging-pch above isn't actually relevant to the test; however,
7
9
// precompiled headers don't play nice with the way we include the platform
You can’t perform that action at this time.
0 commit comments