Skip to content

Commit 77a54a9

Browse files
authored
Fix safety comment for LibraryHandle::get_proc_address (#1010)
1 parent abf67d7 commit 77a54a9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/windows/find_tools.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,13 @@ mod impl_ {
198198
}
199199

200200
/// Get a function pointer to a function in the library.
201-
/// SAFETY: The caller must ensure that the function signature matches the actual function.
201+
/// # SAFETY
202+
///
203+
/// The caller must ensure that the function signature matches the actual function.
202204
/// The easiest way to do this is to add an entry to windows_sys_no_link.list and use the
203205
/// generated function for `func_signature`.
206+
///
207+
/// The function returned cannot be used after the handle is dropped.
204208
unsafe fn get_proc_address<F>(&self, name: &[u8]) -> Option<F> {
205209
let symbol = unsafe { GetProcAddress(self.0, name.as_ptr() as _) };
206210
symbol.map(|symbol| unsafe { mem::transmute_copy(&symbol) })

0 commit comments

Comments
 (0)