Patch up foreign-fn-linkname.rs

This commit is contained in:
Ben Kimock 2024-04-18 17:39:35 -04:00
parent 281178de42
commit 70147cd3ab
2 changed files with 3 additions and 9 deletions

View File

@ -1,20 +1,14 @@
//@ run-pass
//@ ignore-sgx no libc
// Ensure no false positive on "unused extern crate" lint
#![deny(unused_extern_crates)]
#![feature(rustc_private)]
extern crate libc;
use std::ffi::CString;
mod mlibc {
use libc::{c_char, size_t};
use std::ffi::c_char;
extern "C" {
#[link_name = "strlen"]
pub fn my_strlen(str: *const c_char) -> size_t;
pub fn my_strlen(str: *const c_char) -> usize;
}
}

View File

@ -15,7 +15,7 @@ mod zed {
#[cfg(not(windows))]
mod mlibc {
extern crate libc;
use libc::{c_int, c_void, size_t, ssize_t};
use self::libc::{c_int, c_void, size_t, ssize_t};
extern "C" {
pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t;