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