I'll try the ctypes... thanks for pointing me in the right direction and
your help is much appreciated.

Ash

On Mon, Jun 7, 2010 at 10:02 AM, Jeff Hardy <[email protected]> wrote:

> On Sun, Jun 6, 2010 at 8:20 PM, Ashley Abraham <[email protected]>
> wrote:
> > Jeff,
> >     I think I miss read your reply, what you are saying is that if it
> based
> > on ctypes it will work in IronPython as well is it?? I thought you needed
> > IronClad and so on make it work.
>
> Yeah, with ctypes IronPython can call native code directly - it
> actually uses P/Invoke behind the scenes to do it. Python also
> implements ctypes, as do Jython and PyPy, so any code that you write
> using ctypes should work on any Python implementation.
>
> I haven't tested this (seeing as I don't have the exact DLL) but it
> should be pretty close:
>
> from ctypes import *
> vniwave = CDLL('vniwave.dll')
>
> cwavec = vniwave.cwavec
> cwavec.restype = c_int
> cwavec.argtypes = [c_int, c_int, POINTER(c_char_p)]
>
> The only part I'm not sure about is the string[] - I'm assuming the C
> function takes a char**.
>
> Alternatively, you could write the P/Invoke declarations in a C# class
> library and load that into IronPython using clr.AddReference, but I'd
> recommend using ctypes.
>
> - Jeff
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to