mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Add a Windows version of foreign2.rs
This commit is contained in:
parent
18b0a07d49
commit
281178de42
@ -1,9 +1,8 @@
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
//@ pretty-expanded FIXME #23616
|
||||
#![feature(rustc_private)]
|
||||
|
||||
extern crate libc;
|
||||
#![allow(dead_code)]
|
||||
#![feature(rustc_private)]
|
||||
|
||||
mod bar {
|
||||
extern "C" {}
|
||||
@ -13,7 +12,9 @@ mod zed {
|
||||
extern "C" {}
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
mod mlibc {
|
||||
extern crate libc;
|
||||
use libc::{c_int, c_void, size_t, ssize_t};
|
||||
|
||||
extern "C" {
|
||||
@ -21,6 +22,27 @@ mod mlibc {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
mod mlibc {
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::ffi::c_void;
|
||||
|
||||
pub type BOOL = i32;
|
||||
pub type HANDLE = *mut c_void;
|
||||
|
||||
#[link(name = "ntdll")]
|
||||
extern "system" {
|
||||
pub fn WriteFile(
|
||||
hfile: HANDLE,
|
||||
lpbuffer: *const u8,
|
||||
nnumberofbytestowrite: u32,
|
||||
lpnumberofbyteswritten: *mut u32,
|
||||
lpoverlapped: *mut c_void,
|
||||
) -> BOOL;
|
||||
}
|
||||
}
|
||||
|
||||
mod baz {
|
||||
extern "C" {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user