<br><br><div class="gmail_quote">2008/12/15 Dino Viehland <span dir="ltr">&lt;<a href="mailto:dinov@microsoft.com">dinov@microsoft.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Presumably CPython is linking against msvcrt and is using the C abstraction rather than calling the Win32 APIs which return handles directly.<br>
<br>
As Curt said the biggest problem for us is that .NET does not expose C file descriptors. &nbsp;Therefore we could fix this by P/Invoking out to msvcrt. &nbsp;For users on other platforms we&#39;d need to either add support for their platform or hope that their handles == C runtime file descriptors. &nbsp;For something like fileno maybe this is ok because it&#39;s an interop point only - or are there any non-interop uses of fileno in the world?<br>

<br>
What do people think of this? &nbsp;This would be the 1st place where we would add a P/Invoke so I&#39;d want to tread lightly and make sure this is really the right thing to do.</blockquote><div><br><br>Well, some way of doing this is needed if certain Python C extensions are to work with Ironclad. Perhaps a global or per engine setting that allows file handles to be associated with a C descriptor. Users of Ironclad could switch it on if they wished and take the consequences.<br>
<br>Michael Foord<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<div><div></div><div class="Wj3C7c"><br>
-----Original Message-----<br>
From: <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>] On Behalf Of Slide<br>
Sent: Monday, December 15, 2008 10:21 AM<br>
To: Discussion of IronPython<br>
Subject: Re: [IronPython] IronPython and file descriptors<br>
<br>
On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright<br>
&lt;<a href="mailto:tom.wright@resolversystems.com">tom.wright@resolversystems.com</a>&gt; wrote:<br>
&gt; Agreed. It is certainly possible with some work to get a file descriptor and<br>
&gt; pass it to C code.<br>
&gt;<br>
&gt; This is not the problem, however. Ironclad&#39;s aim (eventually) is to allow<br>
&gt; *arbitrary* C extensions &nbsp;to work with Ironpython without changing the<br>
&gt; extensions. Ctypes aim is to allow arbitrary C code to be run by python<br>
&gt; (possibly in other python libraries which you really don&#39;t want to modify).<br>
&gt;<br>
&gt; In CPython .fileno() is a file descriptor and some modules use this fact<br>
&gt; (specifically PIL) by passing file descriptors as integers into C code. I do<br>
&gt; not know how one can make this code work in IronPython unless .fileno()<br>
&gt; returns a file descriptor.<br>
&gt;<br>
&gt; The game here is not making a particular C library work with IronPython by<br>
&gt; modifying this library but making as many libraries as possible work without<br>
&gt; modification. Of course whether this is worthwhile depends on how many<br>
&gt; libraries rely on this fact.<br>
&gt;<br>
&gt; Sorry - I hope this is a little clearer.<br>
&gt;<br>
&gt; Tom<br>
<br>
<br>
How does CPython get the file descriptor for fileno()? Does it just<br>
return the HANDLE on Windows?<br>
<br>
slide<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.ironpythoninaction.com/">http://www.ironpythoninaction.com/</a><br><br><br>