[Mono-dev] vbc compiler treats AscW as CInt with /novbruntimeref
kornelpal at gmail.com
Mon Aug 28 05:03:21 EDT 2006
You are right, the attached test fails with vbc 2.0. I should do check with
vbc 2.0 as well.:)
But this really seems to be a feature. Apply the attached patch to the VB
runtime and compile it:
VB.build.bat 2 debug
It compiles. And have a look at the resulted Strings.AscW.
----- Original Message -----
From: "Rolf Bjarne" <rolfbasura at ya.com>
To: "Kornél Pál" <kornelpal at gmail.com>; <mono-devel-list at lists.ximian.com>
Sent: Monday, August 28, 2006 10:11 AM
Subject: Re: [Mono-dev] vbc compiler treats AscW as CInt with
> I could only make it compile with the v1.1 vbc.exe, the v2.0 compiler
> fails with no error message, so I don't think this is a feature the VB
> runtime should use, since then it won't compile with vbc, only with vbnc.
>> If I compile the attached file:
>> vbnc /target:library /novbruntimeref novbruntimeref.vb
>> I get the result that calls to AscW are replaced with the first parameter
>> passed to AscW but it is Integer on the stack.
>> This replacement is done when:
>> - /novbruntimeref is used
>> - The called AscW is declared in the code being compiled
>> - The called AscW is Shared (or is declared in a Module)
>> - The first argument of the called AscW is ByVal Char
>> Note that the return value and the other arguments of the called AscW are
>> dropped and only the first parameter is preserved on the stack.
>> Also note that this value is really Integer because invalid conversion
>> causes error with type name Integer.
>> I found this when tried to figure out why Convert.ToInt32 is required in
>> AscW. I found no other such hacks (Asc, Chr, ChrW) and I think there are
>> Implementing this in vbnc as well could help the VB runtime.
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date: 25/08/2006
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1417 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060828/db7e42ff/attachment.obj
More information about the Mono-devel-list