File tree 3 files changed +21
-4
lines changed 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -31,3 +31,4 @@ targets = ["x86_64-pc-windows-msvc"]
31
31
[features ]
32
32
default = [" macros" ]
33
33
macros = [" gen" , " windows_macros" ]
34
+ raw_dylib = [" gen/raw_dylib" ] # TODO: remove feature once raw-dylib has stablized
Original file line number Diff line number Diff line change @@ -7,3 +7,6 @@ license = "MIT OR Apache-2.0"
7
7
description = " Code generation for the windows crate"
8
8
9
9
[dependencies ]
10
+
11
+ [features ]
12
+ raw_dylib = []
Original file line number Diff line number Diff line change @@ -29,9 +29,14 @@ impl Function {
29
29
let args = signature. params . iter ( ) . map ( |p| p. gen_win32_abi_arg ( ) ) ;
30
30
let mut link = def. impl_map ( ) . expect ( "Function" ) . scope ( ) . name ( ) ;
31
31
32
- // TODO: workaround for https://github.com/microsoft/windows-rs/issues/463
33
- if link. contains ( "-ms-win-" ) || link == "D3DCOMPILER_47" || link == "SspiCli" {
34
- link = "onecoreuap" ;
32
+ let raw_dylib = cfg ! ( feature = "raw_dylib" ) ;
33
+
34
+ // TODO: remove this whole block once raw-dylib has stabilized as the workarounds
35
+ // will no longer be necessary.
36
+ if !raw_dylib {
37
+ if link. contains ( "-ms-win-" ) || link == "D3DCOMPILER_47" || link == "SspiCli" {
38
+ link = "onecoreuap" ;
39
+ }
35
40
}
36
41
37
42
let static_lib = def
@@ -41,9 +46,17 @@ impl Function {
41
46
_ => None ,
42
47
} )
43
48
. next ( ) ;
49
+
44
50
let link_attr = match static_lib {
45
51
Some ( link) => quote ! { #[ link( name = #link, kind = "static" ) ] } ,
46
- None => quote ! { #[ link( name = #link) ] } ,
52
+ None => {
53
+ // TODO: switch to always using raw-dylib once it has stabilized
54
+ if raw_dylib {
55
+ quote ! { #[ link( name = #link, kind="raw-dylib" ) ] }
56
+ } else {
57
+ quote ! { #[ link( name = #link) ] }
58
+ }
59
+ }
47
60
} ;
48
61
49
62
if signature. has_query_interface ( ) {
You can’t perform that action at this time.
0 commit comments