ctypes pass an array of byte
<p>I want to call this C function from a DLL in python2.7</p>

<pre><code>uint8_t DLL_CONV Mag(uint8_t *t1, uint8_t *t2, uint8_t *t3);
</code></pre>

<p>This function write data to the arrays sent by reference.</p>

<p>This is my python code so far</p>

<pre><code>_mag = hDLL.Mag
#_mag.argtypes =[ctypes.POINTER(ctypes.c_ubyte),ctypes.POINTER(ctypes.c_ubyte),ctypes.POINTER(ctypes.c_ubyte)]
_mag.argtypes =[ctypes.c_ubyte *100,ctypes.c_ubyte *100,ctypes.c_ubyte*100]
_mag.restype = ctypes.c_ubyte
def mag():
    t1 = (ctypes.c_ubyte * 100)()
    t2 = (ctypes.c_ubyte * 100)()
    t3 = (ctypes.c_ubyte * 100)()
    s = _mag( (ctypes.c_ubyte *100)(t1), (ctypes.c_ubyte *100)(t2), (ctypes.c_ubyte *100)(t3) )
    return t1,t2,t3
</code></pre>

<p>I always got a TypeError at <code>s = _mag()</code></p>

<p>I undefined <code>argtypes</code>
and just send the arrays like so</p>

<pre><code>s = _mag( (t1), (t2), (t3) )
</code></pre>

python dll ctypes