Архив метки: c_int

Python ctypes и вызов функций

>>> from ctypes import *
>>> cdll.LoadLibrary("libc.so.6")
<CDLL 'libc.so.6', handle 7f8318993000 at 0x7f8317e7f730>
>>> libc = CDLL("libc.so.6")
>>> libc.printf(b"spam")
4
spam>>> 
>>> c_int()
c_int(0)
>>> c_wchar_p("Hello, World")
c_wchar_p(140201018456432)
>>> c_wchar_p("Hello, World")
c_wchar_p(140201018456688)
>>> c_ushort(-3)
c_ushort(65533)
>>> c_uint(-3)
c_uint(4294967293)
>>> s = "Hello, World"
>>> c_s = c_wchar_p(s)
>>> print(c_s)
c_wchar_p(140201018456432)
>>> print(c_s.value)
Hello, World