diff options
| author | bors <bors@rust-lang.org> | 2013-08-09 16:17:10 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-09 16:17:10 -0700 |
| commit | 6f6dce7bbcfb104a8a1e23b0b93d83cbb770f338 (patch) | |
| tree | 1f5f151dfd5c72f41338c495a38b422ea4aa552c /doc | |
| parent | 1de201c3c6ee1e563ca58d4d6b288929e841081e (diff) | |
| parent | 37fd8f03fdbc622457396877168d2a8d82cf3d2b (diff) | |
| download | rust-6f6dce7bbcfb104a8a1e23b0b93d83cbb770f338.tar.gz rust-6f6dce7bbcfb104a8a1e23b0b93d83cbb770f338.zip | |
auto merge of #8176 : catamorphism/rust/rustpkg-extern-mod, r=catamorphism
r? @graydon Also, notably, make rustpkgtest depend on the rustpkg executable (otherwise, tests that shell out to rustpgk might run when rustpkg doesn't exist).
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/rust.md | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/doc/rust.md b/doc/rust.md index 2f5c310ec83..d285253ffe2 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -744,7 +744,7 @@ There are several kinds of view item: ##### Extern mod declarations ~~~~~~~~ {.ebnf .gram} -extern_mod_decl : "extern" "mod" ident [ '(' link_attrs ')' ] ? ; +extern_mod_decl : "extern" "mod" ident [ '(' link_attrs ')' ] ? [ '=' string_lit ] ? ; link_attrs : link_attr [ ',' link_attrs ] + ; link_attr : ident '=' literal ; ~~~~~~~~ @@ -755,13 +755,25 @@ as the `ident` provided in the `extern_mod_decl`. The external crate is resolved to a specific `soname` at compile time, and a runtime linkage requirement to that `soname` is passed to the linker for -loading at runtime. The `soname` is resolved at compile time by scanning the -compiler's library path and matching the `link_attrs` provided in the -`use_decl` against any `#link` attributes that were declared on the external -crate when it was compiled. If no `link_attrs` are provided, a default `name` -attribute is assumed, equal to the `ident` given in the `use_decl`. - -Three examples of `extern mod` declarations: +loading at runtime. +The `soname` is resolved at compile time by scanning the compiler's library path +and matching the `link_attrs` provided in the `use_decl` against any `#link` attributes that +were declared on the external crate when it was compiled. +If no `link_attrs` are provided, +a default `name` attribute is assumed, +equal to the `ident` given in the `use_decl`. + +Optionally, an identifier in an `extern mod` declaration may be followed by an equals sign, +then a string literal denoting a relative path on the filesystem. +This path should exist in one of the directories in the Rust path, +which by default contains the `.rust` subdirectory of the current directory and each of its parents, +as well as any directories in the colon-separated (or semicolon-separated on Windows) +list of paths that is the `RUST_PATH` environment variable. +The meaning of `extern mod a = "b/c/d";`, supposing that `/a` is in the RUST_PATH, +is that the name `a` should be taken as a reference to the crate whose absolute location is +`/a/b/c/d`. + +Four examples of `extern mod` declarations: ~~~~~~~~{.xfail-test} extern mod pcre (uuid = "54aba0f8-a7b1-4beb-92f1-4cf625264841"); @@ -769,6 +781,8 @@ extern mod pcre (uuid = "54aba0f8-a7b1-4beb-92f1-4cf625264841"); extern mod extra; // equivalent to: extern mod extra ( name = "extra" ); extern mod rustextra (name = "extra"); // linking to 'extra' under another name + +extern mod complicated_mod = "some-file/in/the-rust/path"; ~~~~~~~~ ##### Use declarations |
