@@ -49,7 +49,7 @@ you can call them from Rust by declaring them in
49
49
your Rust code like so:
50
50
51
51
``` rust,no_run
52
- extern {
52
+ extern "C" {
53
53
fn foo_function();
54
54
fn bar_function(x: i32) -> i32;
55
55
}
@@ -138,9 +138,9 @@ required varies per platform, but there are three broad categories:
138
138
* Unix platforms require ` cc ` to be the C compiler. This can be found by
139
139
installing cc/clang on Linux distributions and Xcode on macOS, for example.
140
140
* Windows platforms targeting MSVC (e.g. your target triple ends in ` -msvc ` )
141
- require ` cl.exe ` to be available and in ` PATH ` . This is typically found in
142
- standard Visual Studio installations and the ` PATH ` can be set up by running
143
- the appropriate developer tools shell.
141
+ require Visual Studio to be installed. ` cc-rs ` attempts to locate it, and
142
+ if it fails, ` cl.exe ` is expected to be available in ` PATH ` . This can be
143
+ set up by running the appropriate developer tools shell.
144
144
* Windows platforms targeting MinGW (e.g. your target triple ends in ` -gnu ` )
145
145
require ` cc ` to be available in ` PATH ` . We recommend the
146
146
[ MinGW-w64] ( https://www.mingw-w64.org/ ) distribution, which is using the
@@ -163,7 +163,7 @@ fn main() {
163
163
cc::Build::new()
164
164
.cpp(true) // Switch to C++ library compilation.
165
165
.file("foo.cpp")
166
- .compile("libfoo.a ");
166
+ .compile("foo ");
167
167
}
168
168
```
169
169
@@ -178,7 +178,7 @@ The C++ standard library may be linked to the crate target. By default it's `lib
178
178
.cpp(true)
179
179
.file("foo.cpp")
180
180
.cpp_link_stdlib("stdc++") // use libstdc++
181
- .compile("libfoo.a ");
181
+ .compile("foo ");
182
182
}
183
183
```
184
184
2. by setting the `CXXSTDLIB` environment variable.
@@ -190,7 +190,7 @@ Remember that C++ does name mangling so `extern "C"` might be required to enable
190
190
## CUDA C++ support
191
191
192
192
`cc-rs` also supports compiling CUDA C++ libraries by using the `cuda` method
193
- on `Build` (currently for GNU/Clang toolchains only) :
193
+ on `Build`:
194
194
195
195
```rust,no_run
196
196
fn main() {
@@ -208,8 +208,10 @@ fn main() {
208
208
.flag("-gencode").flag("arch=compute_60,code=sm_60")
209
209
// Generate code for Pascal (Jetson TX2).
210
210
.flag("-gencode").flag("arch=compute_62,code=sm_62")
211
+ // Generate code in parallel
212
+ .flag("-t0")
211
213
.file("bar.cu")
212
- .compile("libbar.a ");
214
+ .compile("bar ");
213
215
}
214
216
```
215
217
0 commit comments