[IronPython] Creating Dynamic Assemblies from IronPython 2.6

Curt Hagenlocher curt at hagenlocher.org
Tue Mar 24 00:34:31 CET 2009


It's not quite that straightforward with p/Invoke though -- it can be *very*
convenient to define multiple overloads for the same C function with
different signatures. Consider the GetPrinter function and the different
versions of the PRINTER_INFO_x structure it can deal with:
<http://msdn.microsoft.com/en-us/library/dd144911(VS.85).aspx>
http://msdn.microsoft.com/en-us/library/dd144911(VS.85).aspx
On Mon, Mar 23, 2009 at 4:21 PM, Jeff Hardy <jdhardy at gmail.com> wrote:

> I've been thinking about whether that functionality is really needed.
> C doesn't support function overloading, so presumably there would only
> ever by one signature per name? I'll have to see if CPython supports
> that.
>
> - Jeff
>
> 2009/3/23 Curt Hagenlocher <curt at hagenlocher.org>:
> > I seem to recall that in Seo's original code, MakeOrAdd was used to build
> up
> > the overloads over time as user code asked for additional method
> signatures
> > for the same method name.  This could presumably be simulated by
> replacing
> > the method group in Python with a new method group that contained all the
> > original infos plus the new one.
> >
> > On Mon, Mar 23, 2009 at 11:11 AM, Dino Viehland <dinov at microsoft.com>
> wrote:
> >>
> >> Do you actually need MakeOrAdd or would the factory that takes multiple
> >> method infos be good enough?
> >>
> >> I'm just reluctant to open up the ability to modify any built-in
> function.
> >>
> >> > -----Original Message-----
> >> > From: users-bounces at lists.ironpython.com [mailto:users-
> >> > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy
> >> > Sent: Saturday, March 21, 2009 1:17 PM
> >> > To: Discussion of IronPython
> >> > Subject: Re: [IronPython] Creating Dynamic Assemblies from IronPython
> >> > 2.6
> >> >
> >> > Hi Dino,
> >> > I'm updating Seo's old ctypes.py to work with 2.6, so unfortuantely
> >> > it's a little more complex than just one method. I could probably use
> >> > a delegate that takes an object[], but BuiltinFunction contains that
> >> > code already, and it is a lot more optimized than I could manage. Plus
> >> > it's less code for me to write :).
> >> >
> >> > - Jeff
> >> >
> >> > On Sat, Mar 21, 2009 at 11:45 AM, Dino Viehland <dinov at microsoft.com>
> >> > wrote:
> >> > > If you only have 1 method and don't need overload resolution I'd
> >> > suggest making a delegate using System.Delegate.CreateDelegate.
> >> > Otherwise this could be made public.
> >> > >
> >> > _______________________________________________
> >> > Users mailing list
> >> > Users at lists.ironpython.com
> >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >> _______________________________________________
> >> Users mailing list
> >> Users at lists.ironpython.com
> >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> >
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090323/858dfc16/attachment.html>


More information about the Ironpython-users mailing list