diff --git a/README.md b/README.md index 736f8e1d2..a58dc68d0 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ you can call them from Rust by declaring them in your Rust code like so: ```rust,no_run -extern { +extern "C" { fn foo_function(); fn bar_function(x: i32) -> i32; } @@ -138,9 +138,9 @@ required varies per platform, but there are three broad categories: * Unix platforms require `cc` to be the C compiler. This can be found by installing cc/clang on Linux distributions and Xcode on macOS, for example. * Windows platforms targeting MSVC (e.g. your target triple ends in `-msvc`) - require `cl.exe` to be available and in `PATH`. This is typically found in - standard Visual Studio installations and the `PATH` can be set up by running - the appropriate developer tools shell. + require Visual Studio to be installed. `cc-rs` attempts to locate it, and + if it fails, `cl.exe` is expected to be available in `PATH`. This can be + set up by running the appropriate developer tools shell. * Windows platforms targeting MinGW (e.g. your target triple ends in `-gnu`) require `cc` to be available in `PATH`. We recommend the [MinGW-w64](https://www.mingw-w64.org/) distribution, which is using the @@ -163,7 +163,7 @@ fn main() { cc::Build::new() .cpp(true) // Switch to C++ library compilation. .file("foo.cpp") - .compile("libfoo.a"); + .compile("foo"); } ``` @@ -178,7 +178,7 @@ The C++ standard library may be linked to the crate target. By default it's `lib .cpp(true) .file("foo.cpp") .cpp_link_stdlib("stdc++") // use libstdc++ - .compile("libfoo.a"); + .compile("foo"); } ``` 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 ## CUDA C++ support `cc-rs` also supports compiling CUDA C++ libraries by using the `cuda` method -on `Build` (currently for GNU/Clang toolchains only): +on `Build`: ```rust,no_run fn main() { @@ -208,8 +208,10 @@ fn main() { .flag("-gencode").flag("arch=compute_60,code=sm_60") // Generate code for Pascal (Jetson TX2). .flag("-gencode").flag("arch=compute_62,code=sm_62") + // Generate code in parallel + .flag("-t0") .file("bar.cu") - .compile("libbar.a"); + .compile("bar"); } ```