1
Fork 0

Add support for raw-dylib with stdcall, fastcall functions on i686-pc-windows-msvc.

This commit is contained in:
Richard Cobbe 2021-06-08 13:56:06 -07:00
parent 8b87e85394
commit a867dd4c7e
19 changed files with 436 additions and 48 deletions

View file

@ -77,10 +77,29 @@ pub struct NativeLib {
pub dll_imports: Vec<DllImport>,
}
#[derive(Clone, Debug, Encodable, Decodable, HashStable)]
#[derive(Clone, Debug, PartialEq, Eq, Encodable, Decodable, Hash, HashStable)]
pub struct DllImport {
pub name: Symbol,
pub ordinal: Option<u16>,
/// Calling convention for the function.
///
/// On x86_64, this is always `DllCallingConvention::C`; on i686, it can be any
/// of the values, and we use `DllCallingConvention::C` to represent `"cdecl"`.
pub calling_convention: DllCallingConvention,
/// Span of import's "extern" declaration; used for diagnostics.
pub span: Span,
}
/// Calling convention for a function defined in an external library.
///
/// The usize value, where present, indicates the size of the function's argument list
/// in bytes.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Encodable, Decodable, Hash, HashStable)]
pub enum DllCallingConvention {
C,
Stdcall(usize),
Fastcall(usize),
Vectorcall(usize),
}
#[derive(Clone, TyEncodable, TyDecodable, HashStable, Debug)]