<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-builtin:yes;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        mso-style-builtin:yes;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        mso-style-builtin:yes;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='color:#1F497D'>This isn’t something we’re
likely to implement soon – there’s lots of challenges in getting
this to work. Unfortunately you’ll probably not be able to get it
working from C# either, but this might be a great use for C++/CLI instead.
I believe we do have a bug filed against it, we just won’t get to it
anytime soon </span><span style='font-family:Wingdings;color:#1F497D'>J</span><span
style='color:#1F497D'>.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>There’s two big problems
here:<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> #1)
Re-creating the unmanaged CPython interfaces – this will be no small chore<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> #2)
Dealing w/ direct access to the raw object layout. For example I don’t
believe bumping the ref count goes through an API, instead it just uses a macro
which adjusts the raw memory.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>#1 is by and large just a matter
of someone cranking through and creating the thunks that map into the
IronPython runtime (I’d include the calls into the PYD’s init and
other functions as well here). But #2 is a large can of worms. What
probably needs to happen is VirtualAlloc’ing a block of memory as
read-only, setting up an exception handler, and fixing the memory up at runtime
as it’s accessed – then when changes happen directly to memory the
C# objects can be updated. <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>All in all it’s a huge
project... In the mean time you might be able to find a .NET library that
does the same thing as the PYD and either wrap that in some Python code if programming
against the same API is a must or just program directly against it if that’s
not one of your requirements.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Glad you’re having a good
time with it!<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:9.0pt;font-family:"Segoe UI","sans-serif"'>From:</span></b><span
style='font-size:9.0pt;font-family:"Segoe UI","sans-serif"'>
users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com] <b>On
Behalf Of </b>Josh Cassell<br>
<b>Sent:</b> Tuesday, October 03, 2006 11:14 AM<br>
<b>To:</b> users@lists.ironpython.com<br>
<b>Subject:</b> [IronPython] pyd files<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Is there ever going to be a way to import from a .pyd file
in IronPython? If not, is it possible to interop to a .pyd file in C# in order
to wrap it for use from IronPython? <o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Btw, I’m new to Python, and it has been very enjoyable
and exciting using IronPython. Thanks very much!<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Josh<o:p></o:p></p>
</div>
</body>
</html>