test: Use a test extern in various foreign fn tests

This commit is contained in:
Brian Anderson 2013-07-30 20:58:55 -07:00
parent 912d806d32
commit 11fc1fd485
9 changed files with 18 additions and 12 deletions

View File

@ -176,3 +176,8 @@ rust_dbg_next_port(uintptr_t base_port) {
next_offset += 1;
return this_port;
}
extern "C" CDECL intptr_t
rust_get_test_int() {
return 1;
}

View File

@ -266,3 +266,4 @@ rust_set_exit_status_newrt
rust_get_exit_status_newrt
rust_take_change_dir_lock
rust_drop_change_dir_lock
rust_get_test_int

View File

@ -18,5 +18,5 @@
use std::libc;
extern {
pub fn rust_get_argc() -> libc::c_int;
pub fn rust_get_test_int() -> libc::intptr_t;
}

View File

@ -14,6 +14,6 @@ pub mod rustrt {
use std::libc;
extern {
pub fn rust_get_argc() -> libc::c_int;
fn rust_get_test_int() -> libc::intptr_t;
}
}

View File

@ -16,6 +16,6 @@ use anonexternmod::*;
pub fn main() {
unsafe {
rust_get_argc();
rust_get_test_int();
}
}

View File

@ -13,11 +13,11 @@ use std::libc;
#[abi = "cdecl"]
#[link_name = "rustrt"]
extern {
fn rust_get_argc() -> libc::c_int;
fn rust_get_test_int() -> libc::intptr_t;
}
pub fn main() {
unsafe {
let _ = rust_get_argc();
let _ = rust_get_test_int();
}
}

View File

@ -17,7 +17,7 @@ mod rustrt1 {
#[abi = "cdecl"]
#[link_name = "rustrt"]
extern {
pub fn rust_get_argc() -> libc::c_int;
fn rust_get_test_int() -> libc::intptr_t;
}
}
@ -27,13 +27,13 @@ mod rustrt2 {
#[abi = "cdecl"]
#[link_name = "rustrt"]
extern {
pub fn rust_get_argc() -> libc::c_int;
fn rust_get_test_int() -> libc::intptr_t;
}
}
pub fn main() {
unsafe {
rustrt1::rust_get_argc();
rustrt2::rust_get_argc();
rustrt1::rust_get_test_int();
rustrt2::rust_get_test_int();
}
}

View File

@ -14,12 +14,12 @@ mod rustrt {
use std::libc;
extern {
pub fn get_task_id() -> libc::intptr_t;
fn rust_get_test_int() -> libc::intptr_t;
}
}
pub fn main() {
unsafe {
rustrt::get_task_id();
rustrt::rust_get_test_int();
}
}

View File

@ -19,6 +19,6 @@ extern mod foreign_lib;
pub fn main() {
unsafe {
let foo = foreign_lib::rustrt::rust_get_argc();
let foo = foreign_lib::rustrt::rust_get_test_int();
}
}