[IronPython] pyd files

Dino Viehland dinov at exchange.microsoft.com
Tue Oct 3 22:37:42 CEST 2006

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 J.

There's two big problems here:
                #1) Re-creating the unmanaged CPython interfaces - this will be no small chore
                #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.

#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.

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.

Glad you're having a good time with it!

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Josh Cassell
Sent: Tuesday, October 03, 2006 11:14 AM
To: users at lists.ironpython.com
Subject: [IronPython] pyd files

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?

Btw, I'm new to Python, and it has been very enjoyable and exciting using IronPython.  Thanks very much!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20061003/bc0ea776/attachment.html>

More information about the Ironpython-users mailing list