Код: Выделить всё
ctypes.c_void_pКод: Выделить всё
import ctypes;
ptr = ctypes.cast(bytes(16), ctypes.c_void_p)
Удивительно, но bytearray нельзя привести к указателю void, и следующая инструкция:
Код: Выделить всё
ptr = ctypes.cast(bytearray(16), ctypes.c_void_p)
Код: Выделить всё
TypeError: 'bytearray' object cannot be interpreted as ctypes.c_void_p
Есть ли способ «убедить» Python в том, что можно привести bytearray к указателю void?>
Подробнее здесь: https://stackoverflow.com/questions/798 ... id-pointer
Мобильная версия