[IronPython] How to call a c dll from IronPython?

Dino Viehland dinov at exchange.microsoft.com
Sun Jan 13 18:54:31 CET 2008

The other possibility is P/Invoke but we don't expose that from IronPython.  Instead you need to write a C# wrapper.  Then you do a clr.AddReference to the wrapper assembly, import it, and call the helper function.

From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Slide [slide.o.mix at gmail.com]
Sent: Sunday, January 13, 2008 4:18 AM
To: Discussion of IronPython
Subject: Re: [IronPython] How to call a c dll from IronPython?

On Jan 13, 2008 1:26 AM, console shark <consolejoker at yahoo.com> wrote:
> I wrote a function and built it to a dll in C. For traditional CPython I
> then used SWIG to generate the module files and can call it easily.
> However I am not sure how to call this same dll and function from
> IronPython? The function looks like:
> int func(char* p, int i, int j);
> Any easy way to do this? Does this require pInvoke and if so how do you do
> this from IronPython?

Check into FePy (http://fepy.sourceforge.net), they have an
implementation of ctypes which should let you do what you want.

Users mailing list
Users at lists.ironpython.com

More information about the Ironpython-users mailing list