Skip to content

Commit

Permalink
Opt-in raw-dylib; fix #133.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigocfd committed Jul 28, 2024
1 parent af19351 commit 37b0472
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ kernel = []
mf = ["oleaut"]
ole = ["user"]
oleaut = ["ole"]
raw-dylib = []
shell = ["oleaut"]
taskschd = ["oleaut"]
user = ["kernel"]
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ WinSafe documentation:

| Native FFI item | Count |
| - | -: |
| Functions | 784 |
| Functions | 783 |
| Structs | 237 |
| Constants | 13,417 |
| Window messages | 655 |
Expand Down Expand Up @@ -77,6 +77,7 @@ The following Cargo features are available so far:
| `mf` | [Media Foundation](https://learn.microsoft.com/en-us/windows/win32/medfound/microsoft-media-foundation-sdk) |
| `ole` | Basic OLE/COM support |
| `oleaut` | [OLE Automation](https://learn.microsoft.com/en-us/windows/win32/api/_automat/) |
| **`raw-dylib`** | **Enables [raw-dylib](https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute) linking** |
| `shell` | Shell32.dll, Shlwapi.dll, and Userenv.dll, the COM-based [Windows Shell](https://learn.microsoft.com/en-us/windows/win32/shell/shell-entry) |
| `taskschd` | [Task Scheduler](https://learn.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page) |
| `user` | User32.dll and ComDlg32.dll, the basic Windows GUI support |
Expand Down
1 change: 0 additions & 1 deletion src/kernel/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ extern_sys! { "kernel32";
QueryProcessCycleTime(HANDLE, &mut u64) -> BOOL
QueryThreadCycleTime(HANDLE, &mut u64) -> BOOL
QueryUnbiasedInterruptTime(&mut u64) -> BOOL
QueryUnbiasedInterruptTimePrecise(&mut u64)
ReadConsoleW(HANDLE, PVOID, u32, *mut u32, PVOID) -> BOOL
ReadFile(HANDLE, PVOID, u32, *mut u32, PVOID) -> BOOL
ReplaceFileW(PCSTR, PCSTR, PCSTR, u32, PVOID, PVOID) -> BOOL
Expand Down
9 changes: 0 additions & 9 deletions src/kernel/funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,15 +1288,6 @@ pub fn QueryUnbiasedInterruptTime() -> SysResult<u64> {
.map(|_| t)
}

/// [`QueryUnbiasedInterruptTimePrecise`](https://learn.microsoft.com/en-us/windows/win32/api/realtimeapiset/nf-realtimeapiset-queryunbiasedinterrupttimeprecise)
/// function.
#[must_use]
pub fn QueryUnbiasedInterruptTimePrecise() -> u64 {
let mut t = u64::default();
unsafe { ffi::QueryUnbiasedInterruptTimePrecise(&mut t); }
t
}

/// [`ReplaceFile`](https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-replacefilew)
/// function.
///
Expand Down
1 change: 1 addition & 0 deletions src/lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The following Cargo features are available so far:
| `mf` | [Media Foundation](https://learn.microsoft.com/en-us/windows/win32/medfound/microsoft-media-foundation-sdk) |
| `ole` | Basic OLE/COM support |
| `oleaut` | [OLE Automation](https://learn.microsoft.com/en-us/windows/win32/api/_automat/) |
| **`raw-dylib`** | **Enables [raw-dylib](https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute) linking** |
| `shell` | Shell32.dll, Shlwapi.dll, and Userenv.dll, the COM-based [Windows Shell](https://learn.microsoft.com/en-us/windows/win32/shell/shell-entry) |
| `taskschd` | [Task Scheduler](https://learn.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page) |
| `user` | User32.dll and ComDlg32.dll, the basic Windows GUI support |
Expand Down
3 changes: 2 additions & 1 deletion src/macros/ffis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ macro_rules! extern_sys {
$func:ident( $( $parm:ty ),* ) $( -> $ret:ty )?
)*
) => {
#[link(name = $dll, kind = "raw-dylib")]
#[cfg_attr(not(feature = "raw-dylib"), link(name = $dll))]
#[cfg_attr(feature = "raw-dylib", link(name = $dll, kind = "raw-dylib"))]
extern "system" {
$(
one_func!( $func( $( $parm ),* ) $(-> $ret)? );
Expand Down

0 comments on commit 37b0472

Please sign in to comment.