[Mono-dev] vbc compiler treats AscW as CInt with /novbruntimeref

Kornél Pál kornelpal at gmail.com
Mon Aug 28 03:03:01 EDT 2006


Hi,

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 no 
others.

Implementing this in vbnc as well could help the VB runtime.

Kornél 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: novbruntimeref.vb
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060828/f8a9aea2/attachment.pl 


More information about the Mono-devel-list mailing list