[IronPython] Calling Win32 API in IronPython

Dino Viehland dinov at exchange.microsoft.com
Fri Apr 28 00:34:17 CEST 2006

Unfortunately we don't have a good way for you to do this directly from Python right now.  I've opened a bug to track it as a future feature request, but I don't know when we'd get around to this.

As a work around you could write a C# stub that interops w/ Win32 via DllImport (if you go this route be sure to check out http://pinvoke.net to see if they've got the signatures for your API already).  Then you can just compile this and use that stub directly from IronPython:

import clr
from MyDllsNameSpace import *

and you have the wrapper types available to you to use from Python.

Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Quantum Infinity
Sent: Thursday, April 27, 2006 2:06 PM
To: users at lists.ironpython.com
Subject: [IronPython] Calling Win32 API in IronPython

Hi All,

This is my first post here and I hope this question was not asked before.

Anyway, is there any way to call a Win32 API in IronPython? I was trying to
search Google along the lines of DllImport and DLLImportAttribute but I
could not find and working example. I also tried to use the samples from Boo
but I couldn't make it to work in IronPython.

In CPython, i can use CTypes and call Win32 API but I just am really lost
with IronPython.


Don’t just search. Find. Check out the new MSN Search!

More information about the Ironpython-users mailing list