class Row(Structure):
    _fields_ = [('cols_count', c_int), ('cols', POINTER(c_char_p))]

def __init__(self, cols):
    self.cols_count = cols
pc = (c_char_p * cols)()
self.cols = cast(pc, POINTER(c_char_p))


class Unit(Structure):
    _fields_ = [('rows_count', c_int), ('rows', POINTER(Row))]

def __init__(self, rows, cols):
    self.rows_count = rows
pr = (Row * rows)()
for r in pr:
    r.__init__(cols)
self.rows = cast(pr, POINTER(Row))
unit = Unit(2, 3)
for i in range(unit.rows_count):
    for j in range(unit.rows[i].cols_count):
        unit.rows[i].cols[j] = string.ascii_lowercase[i * 5 + j] * 5
dll = CDLL('test.dll')
dll.my_func(byref(unit))
Динамические массивы и структуры в структурах в python