<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.gmailquote
        {mso-style-name:gmail_quote;}
span.e
        {mso-style-name:e;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>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.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Martin<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com] <b>On
Behalf Of </b>jeff sacksteder<br>
<b>Sent:</b> Friday, October 13, 2006 2:39 PM<br>
<b>To:</b> Discussion of IronPython<br>
<b>Subject:</b> Re: [IronPython] Typing problem with vendor library?<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='margin-bottom:12.0pt'>I'm finally getting back to
this project. I do not know the Int16() function that you call. Can you
elaborate?<o:p></o:p></p>
<div>
<p class=MsoNormal><span class=gmailquote>On 7/20/06, <b>Martin Maly</b> <<a
href="mailto:Martin.Maly@microsoft.com"> Martin.Maly@microsoft.com</a>>
wrote:</span><o:p></o:p></p>
<div>
<div>
<p><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:navy'>The
problem is that the method is called with int as the last parameter, but the
two overloads in question take "ref Int16" and "ref
UInt16". So the conversion is happening in the opposite direction and
IronPython cannot safely choose between Int16 and UInt16 given that the input
is Int32. They are both narrowing conversions.</span><o:p></o:p></p>
<p><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:navy'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:navy'>You
can either select the method from Overloads, or cast the int to whichever type
you want to use:</span><o:p></o:p></p>
<p><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:navy'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:navy'>board.AIn(channel,
mode, Int16(output))</span><o:p></o:p></p>
<p><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:navy'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:navy'>Hope
this helps</span><o:p></o:p></p>
<p><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:navy'>Martin</span><o:p></o:p></p>
<p><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:navy'> </span><o:p></o:p></p>
<div>
<div class=MsoNormal align=center style='text-align:center'>
<hr size=2 width="100%" align=center>
</div>
<p><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a
href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a>
[mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank">
users-bounces@lists.ironpython.com</a>] <b>On Behalf Of </b>jeff sacksteder<br>
<b>Sent:</b> Wednesday, July 19, 2006 9:54 PM<br>
<b>To:</b> <a href="mailto:users@lists.ironpython.com" target="_blank">users@lists.ironpython.com</a><br>
<b>Subject:</b> [IronPython] Typing problem with vendor library?</span><o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
<p>I have a data-acquisition device whose vendor provides a dotnet library for
software integration. The dynamic nature of IP is giving me a bit of a problem.
To record data from the unit, I make a method call like this:<br>
<br>
errorlevel = board.AIn(channel,mode,output)<br>
<br>
It seems that the library wants to put an UInt16 value into the 'output'
variable. I would not expect this to be a problem, but this produces...<br>
<br>
TypeError: no overloads of AIn could match (int, Range, int) <br>
AIn(int, Range, Reference[Int16])<br>
AIn(int, Range, Reference[UInt16])<br>
<br>
Surely an unsigned Int16 should be able to go into an Int32?<o:p></o:p></p>
</div>
</div>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.ironpython.com">users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com"
target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br>
<o:p></o:p></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>