[IronPython] memoryview / passing string data to a C functionwithout copying

Jeff Hardy jdhardy at gmail.com
Wed Jun 1 17:32:52 CEST 2011


On Tue, May 31, 2011 at 11:01 PM, Markus Schaber
<m.schaber at 3s-software.com> wrote:
> Hi, Peter,
>
>> Von: users-bounces at lists.ironpython.com [mailto:users-
> [...]
>>
>>      Does anyone know how to pass the contents of a string to a C
> function
>> without copying it?
>
> A non-pythonic suggestion:
>
> Maybe you could use the .NET System.FileStream to read the data into a
> byte array (or a .NET memory stream), and pass that one to the cFunc?

This is probably your best bet. file() doesn't return bytes until Python 3.

- Jeff



More information about the Ironpython-users mailing list