mirror of https://github.com/lukechilds/cc-rs.git
Alex Crichton
10 years ago
8 changed files with 81 additions and 0 deletions
@ -0,0 +1,11 @@ |
|||
[root] |
|||
name = "gcc-test" |
|||
version = "0.1.0" |
|||
dependencies = [ |
|||
"gcc 0.3.8", |
|||
] |
|||
|
|||
[[package]] |
|||
name = "gcc" |
|||
version = "0.3.8" |
|||
|
@ -0,0 +1,12 @@ |
|||
[package] |
|||
name = "gcc-test" |
|||
version = "0.1.0" |
|||
authors = ["Alex Crichton <alex@alexcrichton.com>"] |
|||
build = "build.rs" |
|||
|
|||
[lib] |
|||
name = "gcc-test" |
|||
doctest = false |
|||
|
|||
[build-dependencies] |
|||
gcc = { path = ".." } |
@ -0,0 +1,17 @@ |
|||
extern crate gcc; |
|||
|
|||
fn main() { |
|||
gcc::Config::new() |
|||
.file("src/foo.c") |
|||
.compile("libfoo.a"); |
|||
|
|||
gcc::Config::new() |
|||
.file("src/bar1.c") |
|||
.file("src/bar2.c") |
|||
.compile("libbar.a"); |
|||
|
|||
gcc::Config::new() |
|||
.file("src/bar1.c") |
|||
.file("src/bar2.c") |
|||
.compile("libbar.a"); |
|||
} |
@ -0,0 +1,6 @@ |
|||
#include <stdint.h> |
|||
|
|||
int32_t bar1() { |
|||
return 5; |
|||
} |
|||
|
@ -0,0 +1,6 @@ |
|||
#include <stdint.h> |
|||
|
|||
int32_t bar2() { |
|||
return 6; |
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
#include <stdint.h> |
|||
|
|||
int32_t foo() { |
|||
return 4; |
|||
} |
@ -0,0 +1,23 @@ |
|||
extern { |
|||
pub fn foo() -> i32; |
|||
} |
|||
|
|||
extern { |
|||
pub fn bar1() -> i32; |
|||
pub fn bar2() -> i32; |
|||
} |
|||
|
|||
#[test] |
|||
fn foo_here() { |
|||
unsafe { |
|||
assert_eq!(foo(), 4); |
|||
} |
|||
} |
|||
|
|||
#[test] |
|||
fn bar_here() { |
|||
unsafe { |
|||
assert_eq!(bar1(), 5); |
|||
assert_eq!(bar2(), 6); |
|||
} |
|||
} |
Loading…
Reference in new issue