@@ -1395,13 +1395,15 @@ way is to instantiate one of the following classes:
1395
1395
1396
1396
.. class :: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
1397
1397
1398
- Windows only: Instances of this class represent loaded shared libraries,
1398
+ Instances of this class represent loaded shared libraries,
1399
1399
functions in these libraries use the ``stdcall `` calling convention, and are
1400
1400
assumed to return the windows specific :class: `HRESULT ` code. :class: `HRESULT `
1401
1401
values contain information specifying whether the function call failed or
1402
1402
succeeded, together with additional error code. If the return value signals a
1403
1403
failure, an :class: `OSError ` is automatically raised.
1404
1404
1405
+ .. availability :: Windows
1406
+
1405
1407
.. versionchanged :: 3.3
1406
1408
:exc: `WindowsError ` used to be raised,
1407
1409
which is now an alias of :exc: `OSError `.
@@ -1413,14 +1415,17 @@ way is to instantiate one of the following classes:
1413
1415
1414
1416
.. class :: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
1415
1417
1416
- Windows only: Instances of this class represent loaded shared libraries,
1418
+ Instances of this class represent loaded shared libraries,
1417
1419
functions in these libraries use the ``stdcall `` calling convention, and are
1418
1420
assumed to return :c:expr: `int ` by default.
1419
1421
1422
+ .. availability :: Windows
1423
+
1420
1424
.. versionchanged :: 3.12
1421
1425
1422
1426
The *name * parameter can now be a :term: `path-like object `.
1423
1427
1428
+
1424
1429
The Python :term: `global interpreter lock ` is released before calling any
1425
1430
function exported by these libraries, and reacquired afterwards.
1426
1431
@@ -1556,13 +1561,17 @@ These prefabricated library loaders are available:
1556
1561
.. data :: windll
1557
1562
:noindex:
1558
1563
1559
- Windows only: Creates :class: `WinDLL ` instances.
1564
+ Creates :class: `WinDLL ` instances.
1565
+
1566
+ .. availability :: Windows
1560
1567
1561
1568
1562
1569
.. data :: oledll
1563
1570
:noindex:
1564
1571
1565
- Windows only: Creates :class: `OleDLL ` instances.
1572
+ Creates :class: `OleDLL ` instances.
1573
+
1574
+ .. availability :: Windows
1566
1575
1567
1576
1568
1577
.. data :: pydll
@@ -1734,11 +1743,13 @@ See :ref:`ctypes-callback-functions` for examples.
1734
1743
1735
1744
.. function :: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
1736
1745
1737
- Windows only: The returned function prototype creates functions that use the
1746
+ The returned function prototype creates functions that use the
1738
1747
``stdcall `` calling convention. The function will
1739
1748
release the GIL during the call. *use_errno * and *use_last_error * have the
1740
1749
same meaning as above.
1741
1750
1751
+ .. availability :: Windows
1752
+
1742
1753
1743
1754
.. function :: PYFUNCTYPE(restype, *argtypes)
1744
1755
@@ -1964,17 +1975,21 @@ Utility functions
1964
1975
1965
1976
.. function :: DllCanUnloadNow()
1966
1977
1967
- Windows only: This function is a hook which allows implementing in-process
1978
+ This function is a hook which allows implementing in-process
1968
1979
COM servers with ctypes. It is called from the DllCanUnloadNow function that
1969
1980
the _ctypes extension dll exports.
1970
1981
1982
+ .. availability :: Windows
1983
+
1971
1984
1972
1985
.. function :: DllGetClassObject()
1973
1986
1974
- Windows only: This function is a hook which allows implementing in-process
1987
+ This function is a hook which allows implementing in-process
1975
1988
COM servers with ctypes. It is called from the DllGetClassObject function
1976
1989
that the ``_ctypes `` extension dll exports.
1977
1990
1991
+ .. availability :: Windows
1992
+
1978
1993
1979
1994
.. function :: find_library(name)
1980
1995
:module: ctypes.util
@@ -1990,28 +2005,35 @@ Utility functions
1990
2005
.. function :: find_msvcrt()
1991
2006
:module: ctypes.util
1992
2007
1993
- Windows only: return the filename of the VC runtime library used by Python,
2008
+ Returns the filename of the VC runtime library used by Python,
1994
2009
and by the extension modules. If the name of the library cannot be
1995
2010
determined, ``None `` is returned.
1996
2011
1997
2012
If you need to free memory, for example, allocated by an extension module
1998
2013
with a call to the ``free(void *) ``, it is important that you use the
1999
2014
function in the same library that allocated the memory.
2000
2015
2016
+ .. availability :: Windows
2017
+
2001
2018
2002
2019
.. function :: FormatError([code])
2003
2020
2004
- Windows only: Returns a textual description of the error code *code *. If no
2021
+ Returns a textual description of the error code *code *. If no
2005
2022
error code is specified, the last error code is used by calling the Windows
2006
2023
api function GetLastError.
2007
2024
2025
+ .. availability :: Windows
2026
+
2008
2027
2009
2028
.. function :: GetLastError()
2010
2029
2011
- Windows only: Returns the last error code set by Windows in the calling thread.
2030
+ Returns the last error code set by Windows in the calling thread.
2012
2031
This function calls the Windows ``GetLastError() `` function directly,
2013
2032
it does not return the ctypes-private copy of the error code.
2014
2033
2034
+ .. availability :: Windows
2035
+
2036
+
2015
2037
.. function :: get_errno()
2016
2038
2017
2039
Returns the current value of the ctypes-private copy of the system
@@ -2021,11 +2043,14 @@ Utility functions
2021
2043
2022
2044
.. function :: get_last_error()
2023
2045
2024
- Windows only: returns the current value of the ctypes-private copy of the system
2046
+ Returns the current value of the ctypes-private copy of the system
2025
2047
:data: `!LastError ` variable in the calling thread.
2026
2048
2049
+ .. availability :: Windows
2050
+
2027
2051
.. audit-event :: ctypes.get_last_error "" ctypes.get_last_error
2028
2052
2053
+
2029
2054
.. function :: memmove(dst, src, count)
2030
2055
2031
2056
Same as the standard C memmove library function: copies *count * bytes from
@@ -2074,10 +2099,12 @@ Utility functions
2074
2099
2075
2100
.. function :: set_last_error(value)
2076
2101
2077
- Windows only: set the current value of the ctypes-private copy of the system
2102
+ Sets the current value of the ctypes-private copy of the system
2078
2103
:data: `!LastError ` variable in the calling thread to *value * and return the
2079
2104
previous value.
2080
2105
2106
+ .. availability :: Windows
2107
+
2081
2108
.. audit-event :: ctypes.set_last_error error ctypes.set_last_error
2082
2109
2083
2110
@@ -2098,12 +2125,14 @@ Utility functions
2098
2125
2099
2126
.. function :: WinError(code=None, descr=None)
2100
2127
2101
- Windows only: this function is probably the worst-named thing in ctypes. It
2128
+ This function is probably the worst-named thing in ctypes. It
2102
2129
creates an instance of :exc: `OSError `. If *code * is not specified,
2103
2130
``GetLastError `` is called to determine the error code. If *descr * is not
2104
2131
specified, :func: `FormatError ` is called to get a textual description of the
2105
2132
error.
2106
2133
2134
+ .. availability :: Windows
2135
+
2107
2136
.. versionchanged :: 3.3
2108
2137
An instance of :exc: `WindowsError ` used to be created, which is now an
2109
2138
alias of :exc: `OSError `.
@@ -2443,9 +2472,11 @@ These are the fundamental ctypes data types:
2443
2472
2444
2473
.. class :: HRESULT
2445
2474
2446
- Windows only: Represents a :c:type: `!HRESULT ` value, which contains success or
2475
+ Represents a :c:type: `!HRESULT ` value, which contains success or
2447
2476
error information for a function or method call.
2448
2477
2478
+ .. availability :: Windows
2479
+
2449
2480
2450
2481
.. class :: py_object
2451
2482
0 commit comments