Great job! this is why open source succeeds... Let's hope that the ironPython team accepts your efforts.<br>
<br>
Anthony<br><br><div><span class="gmail_quote">On 7/1/05, <b class="gmail_sendername">Jonathan Jacobs</b> <<a href="mailto:korpse-ironpython@kaydash.za.net">korpse-ironpython@kaydash.za.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>I'd like to start off by saying that I'm not sure whether this is the<br>preferred place to post patches. If not, you may want to start writing your<br>reply now.<br><br>Recently IronPython sparked my interest in using DirectX from Python,
<br>however I've run into a couple of issues. One of which I've been able to<br>fix...as far as I can tell anyway.<br><br>Here is a demonstration of the problem:<br><br>IronPython 0.7.6 on .NET 2.0.50215.44<br>Copyright (c) Microsoft Corporation. All rights reserved.
<br>>>> import sys<br>>>> sys.LoadAssemblyByName('System')<br>>>> sys.LoadAssemblyByName('Microsoft.DirectX')<br>>>> import System, Microsoft.DirectX<br>>>> Microsoft.DirectX.Matrix
<br><type 'Microsoft.DirectX.UnsafeNativeMethods+Matrix'><br>>>> Microsoft.DirectX.UnsafeNativeMethods.Matrix<br><type 'Microsoft.DirectX.UnsafeNativeMethods+Matrix'><br><br>Hrm...that's not right. This matters because
Microsoft.DirectX.Matrix<br>provides more functionality than<br>Microsoft.DirectX.UnsafeNativeMethods.Matrix; this problem actually crops up<br>with a number of other objects in the Microsoft.DirectX namespace, namely<br>
Vector3, Quaternion, etc.<br><br>So, I went investigating...<br><br>>>> A = System.Reflection.Assembly.LoadWithPartialName('Microsoft.DirectX')<br>>>> M1, M2 = [t for t in A.GetExportedTypes() if<br>>>>
t.FullName.endswith('Matrix')]<br>>>> M1<br>Microsoft.DirectX.Matrix<br>>>> M2<br>Microsoft.DirectX.UnsafeNativeMethods+Matrix<br>>>> <a href="http://M1.Name">M1.Name</a><br>'Matrix'<br>>>>
<a href="http://M2.Name">M2.Name</a><br>'Matrix'<br>>>> M1.FullName<br>'Microsoft.DirectX.Matrix'<br>>>> M2.FullName<br>'Microsoft.DirectX.UnsafeNativeMethods+Matrix'<br><br>Logically enough, Microsoft.DirectX.Matrix
and<br>Microsoft.DirectX.UnsafeNativeMethods.Matrix both report their name as<br>"Matrix"<br>but not their full name.<br><br>Following the codepath lead me to IronPython.Objects.ReflectedPackage, where<br>I found the problem: GetCoreTypeName. It returns, for all intents and
<br>purposes, the type's Name property, which the calling functions then use as<br>a key to map the type to.<br><br>Of course, this causes a problem when two objects have the same name, which<br>would explain the craziness, after calming down, I was seeing. I've attached
<br>a patch that appears to fix the problem.<br><br>For interest's sake, after applying my patch:<br><br>IronPython 0.7.6 on .NET 2.0.50215.44<br>Copyright (c) Microsoft Corporation. All rights reserved.<br>>>> import sys
<br>>>> sys.LoadAssemblyByName('System')<br>>>> sys.LoadAssemblyByName('Microsoft.DirectX')<br>>>> import System, Microsoft.DirectX<br>>>> Microsoft.DirectX.Matrix<br><type 'Microsoft.DirectX.Matrix
'><br>>>> Microsoft.DirectX.UnsafeNativeMethods.Matrix<br><type 'Microsoft.DirectX.UnsafeNativeMethods+Matrix'><br><br>I'm not sure if I've fixed this The Right Way, but I've attached my patch<br>anyway.
<br>--<br>Jonathan<br><br><br>_______________________________________________<br><a href="http://users-ironpython.com">users-ironpython.com</a> mailing list<br><a href="mailto:users-ironpython.com@lists.ironpython.com">users-ironpython.com@lists.ironpython.com
</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br><br><br><br></blockquote></div><br>