It’s probably easier to use the Reference type from the clr module then using reflection to make a  by-ref type.

 

import clr

import System

ref = clr.Reference[System.Int16](3)

someApi(ref)

print ref.Value #value gets updated in the reference object

 

This is the other way we support reference types in addition to the auto-coercion which isn’t working for you due to the multiple overloads.

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jeff sacksteder
Sent: Monday, October 16, 2006 1:37 PM
To: Discussion of IronPython
Subject: [IronPython] Who understands ByRef?

 

Can anyone enlighten me?

On 10/14/06, jeff sacksteder <[EMAIL PROTECTED]> wrote:

 

On 10/13/06, Martin Maly < [EMAIL PROTECTED]> wrote:

Int16 is a type: System.Int16 and I am calling its constructor, passing "output" as the value:  System.Int16(output), just like in Python you can call:  int(3.5), this is very similar, except constructing .NET System.Int16 type.


An excellent description. However-

"TypeError: no overloads of AIn could match (int, Range, Int16)
  AIn(int, Range, Reference[Int16])
  AIn(int, Range, Reference[UInt16])"

I think I should be using System.Type.MakeByRefType, but I'm not quite getting it.

 

 

_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to