[mono-vb] Issue with callback/delegate

Klaus Siebke ksiebke at web.de
Tue Apr 28 03:43:52 EDT 2009


Hi Rolf,

you are right!

This coding is now correct and compiles w/o any errors also with my
installed vbnc version:
Visual Basic.Net Compiler version 0.0.0.5904 (Mono 2.0 - r)
Copyright (C) 2004-2008 Rolf Bjarne Kvinge. All rights reserved.

But, there are two other issues with the converted C# code.

''''''''''''''''''''''''''''
1. Issue: conversion of this C# statement

    mode2.ptn = new ushort[mode1.num_ptn];

''''''''''''''''''''''''''''

Converted to Mono VB (with full context included)
...

    <StructLayout(LayoutKind.Sequential)> _
    Public Structure HPdfDashMode_Internal
        Public ptn0 As UShort
        Public ptn1 As UShort
        Public ptn2 As UShort
        Public ptn3 As UShort
        Public ptn4 As UShort
        Public ptn5 As UShort
        Public ptn6 As UShort
        Public ptn7 As UShort
        Public num_ptn As UInteger
        Public phase As UInteger
    End Structure

    Public Structure HPdfDashMode
        Public ptn As UShort()
        Public phase As UInteger
    End Structure
...
    Dim mode1 As HPdfDashMode_Internal 
    Dim mode2 As HPdfDashMode

    mode2.phase = mode1.phase
    mode2.ptn = New UShort(mode1.num_ptn - 1) {}  '<--- line causing the
compiler error

Compiler error:
[Task:File=, Line=0, Column=0, Type=Error, Priority=Normal,
Description=Int64_Int32(option)]
[Task:File=/share/source/mono/vbnet/dummytest/dummytest/<MyGenerator> ,
Line=1, Column=1, Type=Error, Priority=Normal, Description=Unexpected error:
There has been an internal error in the compiler:(VBNC99999)]


I'm not sure, if the C# -> VB.net conversion is correct. I've used an online
conversion tool for it:
http://www.developerfusion.com/tools/convert/csharp-to-vb/


''''''''''''''''''''''''''''
2. Issue: Constants are not supported for UInteger data types
''''''''''''''''''''''''''''

Public Const HPDF_COMP_ALL As UInteger = 15

causes:

[Task:File=/share/source/mono/vbnet/vbharutest/vbharutest/<MyGenerator> ,
Line=1, Column=1, Type=Error, Priority=Normal, Description=Unexpected error:
The requested feature is not implemented.(VBNC99999)]


Thank you for your support,
Klaus




Rolf Bjarne Kvinge-2 wrote:
> 
> Hi, 
> 
> This works for me, which version of vbnc are you using? (Open a terminal
> and
> type 'vbnc' will show you).
> 
> My sample:
> ''''''''''''''''''''''''''''
> class HPdfDoc
> 
>  Public Delegate Sub HPDF_ErrorHandler(ByVal error_no As UInteger, ByVal
> detail_no As UInteger, ByVal user_data As IntPtr) 
>  Dim error_handler As New HPDF_ErrorHandler(AddressOf HPdfDoc.ErrorProc)
> 
>  Public Shared Sub ErrorProc(ByVal error_no As UInteger, ByVal detail_no
> As
> UInteger, ByVal user_data As IntPtr)
>      Throw New Exception("")
>  End Sub
> 
> End Class
> ''''''''''''''''''''''''''''
> 
> Rolf
> 
>> -----Original Message-----
>> From: mono-vb-bounces at lists.ximian.com [mailto:mono-vb-
>> bounces at lists.ximian.com] On Behalf Of Klaus Siebke
>> Sent: lunes, 27 de abril de 2009 9:42
>> To: mono-vb at lists.ximian.com
>> Subject: Re: [mono-vb] Issue with callback/delegate
>> 
>> 
>> Hi Rolf,
>> 
>> as you told me, I've tried:
>> 
>> Dim error_handler As New HPDF_ErrorHandler (AddressOf
>> HPdfDoc.ErrorProc)
>> 
>> ... which gives me these compiler errors:
>> 
>> [Task:File=, Line=0, Column=0, Type=Error, Priority=Normal,
>> Description=Int64_Int32(option)]
>> [Task:File=/share/source/mono/vbnet/vbharutest/vbharutest/<MyGenerator>
>> ,
>> Line=1, Column=1, Type=Error, Priority=Normal, Description=Unexpected
>> error:
>> There has been an internal error in the compiler:(VBNC99999)]
>> 
>> Have I missed something?
>> 
>> //Klaus
>> 
>> 
>> 
>> 
>> Rolf Bjarne Kvinge-2 wrote:
>> >
>> >
>> > This is not correct VB (8), you need to do:
>> >
>> > Dim error_handler As New HPDF_ErrorHandler (AddressOf
>> HPdfDoc.ErrorProc)
>> >
>> >
>> 
>> --
>> View this message in context: http://www.nabble.com/Issue-with-
>> callback-delegate-tp23244124p23251516.html
>> Sent from the Mono - VB mailing list archive at Nabble.com.
>> 
>> _______________________________________________
>> Mono-vb mailing list
>> Mono-vb at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-vb
> 
> _______________________________________________
> Mono-vb mailing list
> Mono-vb at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-vb
> 
> 

-- 
View this message in context: http://www.nabble.com/Issue-with-callback-delegate-tp23244124p23271870.html
Sent from the Mono - VB mailing list archive at Nabble.com.



More information about the Mono-vb mailing list