@@ -51,9 +51,6 @@ statically in others which is why build scripts are leveraged to make these
51
51
dynamic decisions. In order to support this kind of dynamism, the following
52
52
modifications are proposed:
53
53
54
- - A new library kind, "abstract". An "abstract" library by itself does not
55
- cause any libraries to be linked. Its purpose is to establish an identifier,
56
- that may be later referred to from the command line flags.
57
54
- Extend syntax of the ` -l ` flag to ` -l [KIND=]lib[:NEWNAME] ` . The ` NEWNAME `
58
55
part may be used to override name of a library specified in the source.
59
56
- Add new meaning to the ` KIND ` part: if "lib" is already specified in the source,
@@ -64,34 +61,35 @@ Example:
64
61
65
62
``` rust
66
63
// mylib.rs
67
- #[link(name = " foo" , kind= " dylib" )]
64
+ #[link(name= " foo" , kind= " dylib" )]
68
65
extern {
69
66
// dllimport applied
70
67
}
71
68
72
- #[link(name = " bar" , kind= " static" )]
69
+ #[link(name= " bar" , kind= " static" )]
73
70
extern {
74
71
// dllimport not applied
75
72
}
76
73
77
- #[link(name = " baz" , kind = " abstract " )]
74
+ #[link(name= " baz" )]
78
75
extern {
79
- // dllimport not applied, "baz" not linked
76
+ // kind defaults to "dylib", dllimport applied
80
77
}
81
78
```
82
79
83
- ```
80
+ ``` sh
84
81
rustc mylib.rs -l static=foo # change foo's kind to "static", dllimport will not be applied
85
- rustc mylib.rs -l foo:newfoo # link newfoo instead of foo
86
- rustc mylib.rs -l dylib=baz:quoox # specify baz 's kind as "dylib", change link name to quoox.
82
+ rustc mylib.rs -l foo:newfoo # link newfoo instead of foo, keeping foo's kind as "dylib"
83
+ rustc mylib.rs -l dylib=bar # change bar 's kind to "dylib", dllimport will be applied
87
84
```
88
85
89
86
### Unbundled static libs (optional)
90
87
91
88
It had been pointed out that sometimes one may wish to link to a static system library
92
89
(i.e. one that is always available to the linker) without bundling it into .lib's and .rlib's.
93
90
For this use case we'll introduce another library "kind", "static-nobundle".
94
- Such libraries would be treated in the same way as "static", minus the bundling.
91
+ Such libraries would be treated in the same way as "static", except they will not be bundled into
92
+ the target .lib/.rlib.
95
93
96
94
# Drawbacks
97
95
[ drawbacks ] : #drawbacks
@@ -147,6 +145,4 @@ meaning that it will be common that these attributes are left off by accident.
147
145
# Unresolved questions
148
146
[ unresolved ] : #unresolved-questions
149
147
150
- - Should un-overridden "abstract" kind cause an error, a warning, or be silently ignored?
151
- - Do we even need "abstract"? Since kind can be overridden, there's no harm in providing a default in the source.
152
148
- Should we allow dropping a library specified in the source from linking via ` -l lib: ` (i.e. "rename to empty")?
0 commit comments