mmap and ctypes

castironpi castironpi at gmail.com
Sun Aug 17 06:49:16 CEST 2008


On Aug 16, 5:20 pm, castironpi <castiro... at gmail.com> wrote:
> On Aug 16, 4:42 pm, "Michel Claveau - NoSpam SVP ; merci"
>
> <noZ.sp... at ZZ.ZsvpZ.com> wrote:
> > Hi!
>
> > I use mmap for interchange data between Python & Autoit.  For that, I
> > use (Autoit's side) a little DLL.
> > This DLL can, perhaps, be used with ctypes.
>
> > @-salutations
> > --
> > Michel Claveau
>
> Say more-- what DLL?  @-greetings

This worked to 'cast' the mmap memory block to an integer:

   a= ctypesbuf.get( m, 0, ctypes.POINTER( ctypes.c_uint32 ) )

where ctypesbuf is a C extension module, and 'get' contains:

   ...
   char* seg= map->data+ index;
   PyObject* char_buf= PyObject_CallFunction( ctypesmod_cast, "IO",
seg, tp );
   return char_buf;

However I find no equivalent to 'map->data' in Python.



More information about the Python-list mailing list