Posts Tagged ‘ctypes’

Arrays in ctypes

In ctypes an array is defined by multiplying a type by the number of elements you want allocated within the array, for example:

In Python
class marijuana_amount(Union):
    _fields_ = [
    ("weed_long", c_long),
    ("weed_int", c_int),
    ("weed_char", c_char * 8),
    ]

c_languagepython-logo

C-Python-ctypes Data Type Mapping Table

data type map c python ctypes

Quick-Tip: 3 Ways to Load Ctypes in Python

  1. cdll()
  2. windll()
  3. oledll()

python-300x187