Jim and Martin,
Thanks for the reply, and it makes sense :)
Unfortunately, a call to CheckCooperativeLevel() returns True, not a tuple. This is probably because there are two overloaded CheckCooperativeLevel methods in the Device class in the Microsoft.DirectX.Direct3D namespace. They are:
public bool CheckCooperativeLevel(); public bool CheckCooperativeLevel(out int result);
IronPython has no way of knowing I want the second and not the first.
--Nick
Jim wrote:
<< Martin's response is right, but I'm afraid that the best way to use these return values might not be obvious to everyone. Python's tuple packing and unpacking operations are often used for multiple return values in standard Python libraries and IronPython should feel the same way. Here's how these calls should look in IronPython:
ret, result = CheckCooperativeLevel() m, i, j, k = C.M()
And for completeness, I'll add that 'ref' parameters are both passed to the function and returned as an additional return value.
-Jim >>
Martin Maly wrote:
oneThe return value and output parameters (if they are in total more than one) are returned as tuple:
namespace N { public class C { public static int M(out int i, out int j, out int k) { i = 20; j = 30; k = 40; return 10; } } }
Python: i = C.M() print i
(10, 20, 30, 40)
If there is just one output of the function (i.e. void function with
Ofout parameter), the value comes back as a function return value.
Martin
-----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf
resultNick Jacobson Sent: Tuesday, May 10, 2005 11:08 PM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] 'out' parameters
How will IronPython deal with functions that, in C#, use an 'out' variable?
For example, in Microsoft.DirectX.Direct3D, this function exists:
public bool CheckCooperativeLevel(out int result);
If I call this from IronPython, there's no way that the value of
would be modified, right? But it needs to be changed within the function CheckCooperativeLevel, and I need to get the result back!
Thanks,
--Nick
_______________________________________________ users-ironpython.com mailing list users-ironpython.com at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
_______________________________________________ users-ironpython.com mailing list users-ironpython.com@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com