Use attributes for native module ABI and link name

This patch changes how to specify ABI and link name of a native module.

Before:
  native "cdecl" mod llvm = "rustllvm" {...}

After:
  #[abi = "cdecl"]
  #[link_name = "rustllvm"]
  native mod llvm {...}

The old optional syntax for ABI and link name is no longer supported.

Fixes issue #547
This commit is contained in:
Haitao Li
2011-11-16 22:49:38 -06:00
committed by Brian Anderson
parent 7a9b66db63
commit 88f29aab27
46 changed files with 168 additions and 128 deletions

View File

@@ -6,7 +6,9 @@ TODO: Restructure and document
// FIXME Somehow merge stuff duplicated here and macosx_os.rs. Made difficult
// by https://github.com/graydon/rust/issues#issue/268
native "cdecl" mod libc = "" {
#[link_name = ""]
#[abi = "cdecl"]
native mod libc {
fn read(fd: int, buf: *u8, count: uint) -> int;
fn write(fd: int, buf: *u8, count: uint) -> int;
fn fread(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
@@ -81,7 +83,8 @@ fn waitpid(pid: int) -> int {
ret status;
}
native "cdecl" mod rustrt {
#[abi = "cdecl"]
native mod rustrt {
fn rust_getcwd() -> str;
}