IronPython and callback delegates with 'out' or 'ref' parameters -- the obvious way doesn't work
The actual how-to is given here.
The only on-line documentation I could find that mentioned this has a
TODO - Delegates with out/ref parameters
about halfway down.
So, experiment time. Build callback.dll
containing (or the same with 'out
'):
and call it from IronPython 2.6:
which yields
Array[object]((<System.IntPtr object at 0x000000000000002B [42]>, False))
In sum -- it fails silently; the direct return value is fine, but mutating the actually by-value parameter does nothing.
Replacing the bool
with int
, and using non-default values shows that the value of a ref
parameter is passed in correctly, it just can't be passed out with direct assignment.
No comments :
Post a Comment