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> &lt;<a href="mailto:korpse-ironpython@kaydash.za.net">korpse-ironpython@kaydash.za.net</a>&gt; 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>&gt;&gt;&gt; import sys<br>&gt;&gt;&gt; sys.LoadAssemblyByName('System')<br>&gt;&gt;&gt; sys.LoadAssemblyByName('Microsoft.DirectX')<br>&gt;&gt;&gt; import System, Microsoft.DirectX<br>&gt;&gt;&gt; Microsoft.DirectX.Matrix
<br>&lt;type 'Microsoft.DirectX.UnsafeNativeMethods+Matrix'&gt;<br>&gt;&gt;&gt; Microsoft.DirectX.UnsafeNativeMethods.Matrix<br>&lt;type 'Microsoft.DirectX.UnsafeNativeMethods+Matrix'&gt;<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>&gt;&gt;&gt; A = System.Reflection.Assembly.LoadWithPartialName('Microsoft.DirectX')<br>&gt;&gt;&gt; M1, M2 = [t for t in A.GetExportedTypes() if<br>&gt;&gt;&gt; 
t.FullName.endswith('Matrix')]<br>&gt;&gt;&gt; M1<br>Microsoft.DirectX.Matrix<br>&gt;&gt;&gt; M2<br>Microsoft.DirectX.UnsafeNativeMethods+Matrix<br>&gt;&gt;&gt; <a href="http://M1.Name">M1.Name</a><br>'Matrix'<br>&gt;&gt;&gt; 
<a href="http://M2.Name">M2.Name</a><br>'Matrix'<br>&gt;&gt;&gt; M1.FullName<br>'Microsoft.DirectX.Matrix'<br>&gt;&gt;&gt; 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>&quot;Matrix&quot;<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>&gt;&gt;&gt; import sys
<br>&gt;&gt;&gt; sys.LoadAssemblyByName('System')<br>&gt;&gt;&gt; sys.LoadAssemblyByName('Microsoft.DirectX')<br>&gt;&gt;&gt; import System, Microsoft.DirectX<br>&gt;&gt;&gt; Microsoft.DirectX.Matrix<br>&lt;type 'Microsoft.DirectX.Matrix
'&gt;<br>&gt;&gt;&gt; Microsoft.DirectX.UnsafeNativeMethods.Matrix<br>&lt;type 'Microsoft.DirectX.UnsafeNativeMethods+Matrix'&gt;<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>