Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
2d6c5a86
Kaydet (Commit)
2d6c5a86
authored
May 26, 2006
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Reordered, and wrote more docs.
üst
f8458777
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
127 additions
and
74 deletions
+127
-74
libctypesref.tex
Doc/lib/libctypesref.tex
+127
-74
No files found.
Doc/lib/libctypesref.tex
Dosyayı görüntüle @
2d6c5a86
\subsection
{
ctypes reference
\label
{
ctypes-reference
}}
\subsection
{
ctypes reference
\label
{
ctypes-reference
}}
ctypes defines a lot of C compatible datatypes, and also allows to
% functions
define your own types. Among other things, a ctypes type instance
\subsubsection
{
ctypes functions
}
holds a memory block that contains C compatible data.
\begin{funcdesc}
{
addressof
}{
obj
}
\begin{funcdesc}
{
addressof
}{
obj
}
Returns the address of the memory buffer as integer.
\var
{
obj
}
must
Returns the address of the memory buffer as integer.
\var
{
obj
}
must
...
@@ -17,9 +16,6 @@ Returns the alignment requirements of a ctypes type.
...
@@ -17,9 +16,6 @@ Returns the alignment requirements of a ctypes type.
\begin{excclassdesc}
{
ArgumentError
}{}
\begin{excclassdesc}
{
ArgumentError
}{}
\end{excclassdesc}
\end{excclassdesc}
\begin{classdesc}
{
BigEndianStructure
}{}
\end{classdesc}
\begin{funcdesc}
{
byref
}{
obj
}
\begin{funcdesc}
{
byref
}{
obj
}
Returns a light-weight pointer to
\var
{
obj
}
, which must be an instance
Returns a light-weight pointer to
\var
{
obj
}
, which must be an instance
of a ctypes type. The returned object can only be used as a foreign
of a ctypes type. The returned object can only be used as a foreign
...
@@ -27,6 +23,118 @@ function call parameter. It behaves similar to \code{pointer(obj)},
...
@@ -27,6 +23,118 @@ function call parameter. It behaves similar to \code{pointer(obj)},
but the construction is a lot faster.
but the construction is a lot faster.
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
cast
}{
obj, type
}
\end{funcdesc}
\begin{funcdesc}
{
CFUNCTYPE
}{
restype, *argtypes
}
\end{funcdesc}
\begin{funcdesc}
{
create
_
string
_
buffer
}{
init
_
or
_
size
\optional
{
, size
}}
This function creates a mutable character buffer. The returned object
is a ctypes array of
\code
{
c
_
char
}
.
\var
{
init
_
or
_
size
}
must be an integer which specifies the size of the
array, or a string which will be used to initialize the array items.
If a string is specified as first argument, the buffer is made one
item larger than the length of the string so that the last element in
the array is a NUL termination character. An integer can be passed as
second argument which allows to specify the size of the array if the
length of the string should not be used.
If the first parameter is a unicode string, it is converted into an
8-bit string according to ctypes conversion rules.
\end{funcdesc}
\begin{funcdesc}
{
create
_
unicode
_
buffer
}{
init
_
or
_
size
\optional
{
, size
}}
This function creates a mutable unicode character buffer. The
returned object is a ctypes array of
\code
{
c
_
wchar
}
.
\var
{
init
_
or
_
size
}
must be an integer which specifies the size of the
array, or a unicode string which will be used to initialize the array
items.
If a unicode string is specified as first argument, the buffer is made
one item larger than the length of the string so that the last element
in the array is a NUL termination character. An integer can be passed
as second argument which allows to specify the size of the array if
the length of the string should not be used.
If the first parameter is a 8-bit string, it is converted into an
unicode string according to ctypes conversion rules.
\end{funcdesc}
\begin{funcdesc}
{
DllCanUnloadNow
}{}
Windows only: This function is a hook which allows to implement
inprocess COM servers with ctypes. It is called from the
\code
{
DllCanUnloadNow
}
exported function that the
\code
{_
ctypes
}
extension module exports.
\end{funcdesc}
\begin{funcdesc}
{
DllGetClassObject
}{}
Windows only: This function is a hook which allows to implement
inprocess COM servers with ctypes. It is called from the
\code
{
DllGetClassObject
}
exported function that the
\code
{_
ctypes
}
extension module exports.
\end{funcdesc}
\begin{funcdesc}
{
FormatError
}{}
Windows only:
\end{funcdesc}
\begin{funcdesc}
{
GetLastError
}{}
Windows only:
\end{funcdesc}
\begin{funcdesc}
{
memmove
}{
dst, src, count
}
\end{funcdesc}
\begin{funcdesc}
{
memset
}{
dst, c, count
}
\end{funcdesc}
\begin{funcdesc}
{
POINTER
}{}
\end{funcdesc}
\begin{funcdesc}
{
pointer
}{}
\end{funcdesc}
\begin{funcdesc}
{
PYFUNCTYPE
}{
restype, *argtypes
}
\end{funcdesc}
\begin{funcdesc}
{
pythonapi
}{}
\end{funcdesc}
\begin{funcdesc}
{
resize
}{}
\end{funcdesc}
\begin{funcdesc}
{
set
_
conversion
_
mode
}{}
\end{funcdesc}
\begin{funcdesc}
{
sizeof
}{}
\end{funcdesc}
\begin{funcdesc}
{
string
_
at
}{
address
}
\end{funcdesc}
\begin{funcdesc}
{
WinError
}{}
\end{funcdesc}
\begin{funcdesc}
{
WINFUNCTYPE
}{
restype, *argtypes
}
\end{funcdesc}
\begin{funcdesc}
{
wstring
_
at
}{
address
}
\end{funcdesc}
% data types
\subsubsection
{
data types
}
ctypes defines a lot of C compatible datatypes, and also allows to
define your own types. Among other things, a ctypes type instance
holds a memory block that contains C compatible data.
% simple data types
\subsubsection
{
simple data types
}
\begin{classdesc}
{
c
_
byte
}{
\optional
{
value
}}
\begin{classdesc}
{
c
_
byte
}{
\optional
{
value
}}
Represents a C
\code
{
signed char
}
datatype, and interprets the value
Represents a C
\code
{
signed char
}
datatype, and interprets the value
as small integer. The constructor accepts an optional integer
as small integer. The constructor accepts an optional integer
...
@@ -133,35 +241,28 @@ Represents a C \code{size_t} datatype.
...
@@ -133,35 +241,28 @@ Represents a C \code{size_t} datatype.
\begin{classdesc}
{
c
_
wchar
_
p
}{
\optional
{
value
}}
\begin{classdesc}
{
c
_
wchar
_
p
}{
\optional
{
value
}}
\end{classdesc}
\end{classdesc}
\begin{funcdesc}
{
cast
}{
obj, type
}
% structured data types
\
end{funcdesc
}
\
subsubsection
{
structured data types
}
\begin{classdesc}
{
CDLL
}{
name, mode=RTLD
_
LOCAL, handle=None
}
\begin{classdesc}
{
BigEndianStructure
}{
}
\end{classdesc}
\end{classdesc}
\begin{
datadesc}
{
cdll
}
\begin{
classdesc}
{
LittleEndianStructure
}{
}
\end{
data
desc}
\end{
class
desc}
\begin{
funcdesc}
{
CFUNCTYPE
}{
restype, *argtypes
}
\begin{
classdesc}
{
Structure
}{
}
\end{
func
desc}
\end{
class
desc}
\begin{
funcdesc}
{
create
_
string
_
buffer
}{
init
\optional
{
, size
}
}
\begin{
classdesc}
{
Union
}{
}
\end{
func
desc}
\end{
class
desc}
\begin{funcdesc}
{
create
_
unicode
_
buffer
}{
init
\optional
{
, size
}}
\end{funcdesc}
\begin{funcdesc}
{
DllCanUnloadNow
}{}
\end{funcdesc}
\begin{funcdesc}
{
DllGetClassObject
}{}
\begin{classdesc}
{
CDLL
}{
name, mode=RTLD
_
LOCAL, handle=None
}
\end{funcdesc}
\end{classdesc}
\begin{funcdesc}
{
FormatError
}{}
\end{funcdesc}
\begin{
funcdesc}
{
GetLastError
}{
}
\begin{
datadesc}
{
cdll
}
\end{
func
desc}
\end{
data
desc}
\begin{classdesc}
{
HRESULT
}{}
\begin{classdesc}
{
HRESULT
}{}
\end{classdesc}
\end{classdesc}
...
@@ -169,27 +270,12 @@ Represents a C \code{size_t} datatype.
...
@@ -169,27 +270,12 @@ Represents a C \code{size_t} datatype.
\begin{classdesc}
{
LibraryLoader
}{
dlltype
}
\begin{classdesc}
{
LibraryLoader
}{
dlltype
}
\end{classdesc}
\end{classdesc}
\begin{classdesc}
{
LittleEndianStructure
}{}
\end{classdesc}
\begin{funcdesc}
{
memmove
}{
dst, src, count
}
\end{funcdesc}
\begin{funcdesc}
{
memset
}{
dst, c, count
}
\end{funcdesc}
\begin{classdesc}
{
OleDLL
}{
name, mode=RTLD
_
LOCAL, handle=None
}
\begin{classdesc}
{
OleDLL
}{
name, mode=RTLD
_
LOCAL, handle=None
}
\end{classdesc}
\end{classdesc}
\begin{datadesc}
{
oledll
}
\begin{datadesc}
{
oledll
}
\end{datadesc}
\end{datadesc}
\begin{funcdesc}
{
POINTER
}{}
\end{funcdesc}
\begin{funcdesc}
{
pointer
}{}
\end{funcdesc}
\begin{classdesc}
{
py
_
object
}{}
\begin{classdesc}
{
py
_
object
}{}
\end{classdesc}
\end{classdesc}
...
@@ -199,48 +285,15 @@ Represents a C \code{size_t} datatype.
...
@@ -199,48 +285,15 @@ Represents a C \code{size_t} datatype.
\begin{datadesc}
{
pydll
}{}
\begin{datadesc}
{
pydll
}{}
\end{datadesc}
\end{datadesc}
\begin{funcdesc}
{
PYFUNCTYPE
}{
restype, *argtypes
}
\end{funcdesc}
\begin{funcdesc}
{
pythonapi
}{}
\end{funcdesc}
\begin{funcdesc}
{
resize
}{}
\end{funcdesc}
\begin{datadesc}
{
RTLD
_
GLOBAL
}
\begin{datadesc}
{
RTLD
_
GLOBAL
}
\end{datadesc}
\end{datadesc}
\begin{datadesc}
{
RTLD
_
LOCAL
}
\begin{datadesc}
{
RTLD
_
LOCAL
}
\end{datadesc}
\end{datadesc}
\begin{funcdesc}
{
set
_
conversion
_
mode
}{}
\end{funcdesc}
\begin{funcdesc}
{
sizeof
}{}
\end{funcdesc}
\begin{funcdesc}
{
string
_
at
}{
address
}
\end{funcdesc}
\begin{classdesc}
{
Structure
}{}
\end{classdesc}
\begin{classdesc}
{
Union
}{}
\end{classdesc}
\begin{classdesc}
{
WinDLL
}{
name, mode=RTLD
_
LOCAL, handle=None
}
\begin{classdesc}
{
WinDLL
}{
name, mode=RTLD
_
LOCAL, handle=None
}
\end{classdesc}
\end{classdesc}
\begin{datadesc}
{
windll
}
\begin{datadesc}
{
windll
}
\end{datadesc}
\end{datadesc}
\begin{funcdesc}
{
WinError
}{}
\end{funcdesc}
\begin{funcdesc}
{
WINFUNCTYPE
}{
restype, *argtypes
}
\end{funcdesc}
\begin{funcdesc}
{
wstring
_
at
}{
address
}
\end{funcdesc}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment