tec at knology.net
Tue Sep 11 14:09:58 CEST 2007
On Sep 10, 3:31 pm, Marc 'BlackJack' Rintsch <bj_... at gmx.net> wrote:
> On Mon, 10 Sep 2007 11:38:50 -0700, Tim wrote:
> > How do I memcpy from a pointer to an array of floats in python?
> > I get errors: NameError: global name 'row' is not defined
> Well than the (global) name `row` is not defined. Quite clear message,
> isn't it? ;-)
> > I want to be able to get the row[i] array element. In C I would
> > normally place the address of row as the first argument.
> > cdll.msvcrt.memcpy( row, pData, 256 )
> > If I define row as the following I also get the following error:
> > row = ones( TOTAL_PARAMETER_ENTRIES, dtype=float )
> > ArgumentError: argument 1: <type 'exceptions.TypeError'>: Don't know
> > how to convert parameter 1
> You don't give enough information so we have to guess. For example I
> guess the `ones()` function comes from one of the packages `numeric`,
> `numarray` or `numpy`!?
> This function returns a Python object. You can't use arbitrary Python
> objects with `ctypes`. `memcpy` expects a pointer not an object.
> Marc 'BlackJack' Rintsch
Can I initialize something in Python that I can get access to it's
self.data = TOTAL_OUTPUT_PARMETERS*[c_char_p("temp")]
self.data = [TOTAL_OUTPUT_PARMETERS*1.0]*TOTAL_PARAMETER_ENTRIES
I need to be able to copy the contents of a pointer to shared memory
into an array of floats so I can index into that array and see my
data. I have a pointer to shared meory but I don't know how to access
Here is what I would like to write:
shared_memory_pointer = windll.kernel32.MapViewOfFile(hMapObject,
0, 0, TABLE_SHMEMSIZE)
memcpy( self.data, shared_memory_pointer, my_size )
More information about the Python-list