Skip to content

Commit

Permalink
Add tests for lib defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
wagenet committed Feb 23, 2017
1 parent ae32b6e commit 69c5359
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test/run-pass/auxiliary/clibrary.rs
@@ -0,0 +1,15 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// no-prefer-dynamic
#![crate_type = "staticlib"]

#[no_mangle]
pub extern "C" fn foo(x:i32) -> i32 { x }
23 changes: 23 additions & 0 deletions src/test/run-pass/lib-defaults.rs
@@ -0,0 +1,23 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// aux-build:clibrary.rs
// compile-flags: -lclibrary

#[link(name = "clibrary", kind = "static")]
extern "C" {
pub fn foo(x:i32) -> i32;
}

fn main() {
unsafe {
foo(42);
}
}

0 comments on commit 69c5359

Please sign in to comment.