Re: [IronPython] IronPython and file descriptors

2008-12-18 Thread Tom Wright
/View.aspx?WorkItemId=20242 Michael *From:* users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Michael Foord *Sent:* Monday, December 15, 2008 12:53 PM *To:* Discussion of IronPython *Subject:* Re: [IronPython] IronPython and file descriptors 2008/12

Re: [IronPython] IronPython and file descriptors

2008-12-16 Thread Tom Wright
] IronPython and file descriptors 2008/12/15 Dino Viehland di...@microsoft.com mailto:di...@microsoft.com Presumably CPython is linking against msvcrt and is using the C abstraction rather than calling the Win32 APIs which return handles directly. As Curt said the biggest problem for us

[IronPython] IronPython and file descriptors

2008-12-15 Thread Tom Wright
Hi, At the moment file.fileno() returns an arbitrary identifier of a python file rather than a true file descriptor. This is semi-blocking the Ironclad port of PIL. Code in PIL gets an integer using fileno() and passes it directly to C code where a call to write() is made. To fix this one

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Curt Hagenlocher
There's no such thing as a file descriptor number in .NET -- or, for that matter, in Windows itself! :) (The latter is something of a semantic point, of course, as a HANDLE serves something of the same role in Win32 as a file descriptor number does in Unix.) If you have a FileStream, I think you

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Tom Wright
Not so: Though admittedly you have to do quite a bit of work to get the file descriptor into .NET. http://msdn.microsoft.com/en-us/library/bdts1c9x(VS.71).aspx To clarify - the C library was written to work with Python (not IronPython) and is not my code. Thanks, Tom Curt Hagenlocher

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Curt Hagenlocher
Ah, that was the function I was looking for. Sure, the file descriptor exists in the C library under Windows. But the C library is basically doing exactly the same thing as IronPython is; it's maintaining the file descriptor number as an abstraction on top of the HANDLE that the operating system

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Tom Wright
Agreed. It is certainly possible with some work to get a file descriptor and pass it to C code. This is not the problem, however. Ironclad's aim (eventually) is to allow *arbitrary* C extensions to work with Ironpython without changing the extensions. Ctypes aim is to allow arbitrary C code

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Slide
On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright tom.wri...@resolversystems.com wrote: Agreed. It is certainly possible with some work to get a file descriptor and pass it to C code. This is not the problem, however. Ironclad's aim (eventually) is to allow *arbitrary* C extensions to work with

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Curt Hagenlocher
I think I understand the motivation pretty well; what I'm saying is that I don't see that this is possible. IronPython has no access to the table being used by the C library to map between Windows HANDLEs and clib file descriptors, so we can't return a clib-compatible fd. Even if we were to

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Dino Viehland
, December 15, 2008 10:21 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython and file descriptors On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright tom.wri...@resolversystems.com wrote: Agreed. It is certainly possible with some work to get a file descriptor and pass it to C code

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Curt Hagenlocher
, 2008 10:21 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython and file descriptors On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright tom.wri...@resolversystems.com wrote: Agreed. It is certainly possible with some work to get a file descriptor and pass it to C code

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Michael Foord
...@lists.ironpython.com] On Behalf Of Slide Sent: Monday, December 15, 2008 10:21 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython and file descriptors On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright tom.wri...@resolversystems.com wrote: Agreed. It is certainly possible with some work

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Michael Foord
*Sent:* Monday, December 15, 2008 12:53 PM *To:* Discussion of IronPython *Subject:* Re: [IronPython] IronPython and file descriptors 2008/12/15 Dino Viehland di...@microsoft.com mailto:di...@microsoft.com Presumably CPython is linking against msvcrt and is using the C abstraction rather than