Passing stucts between C++ and VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • williamwm
    New Member
    • Jun 2007
    • 1

    #1

    Passing stucts between C++ and VB

    I am a hardware engineer writing software for a project on which I am the systems engineer.

    I have an issue in passing structures between Visual C++.NET 2003 and VB.NET 2003.

    In C++ code there is a public function:
    char ReadReg(string* name, t_Time* value)

    t_Time is a structure which in C++ is defined thus:

    public:
    __value struct t_Time
    {
    public:
    Byte hours;
    Byte minutes;
    Byte seconds;
    };

    The corresponding definition I have used in VB is:

    Public Structure t_Time
    Public hours As Byte
    Public minutes As Byte
    Public seconds As Byte
    End Structure

    and function call is

    Dim lidarTime As t_Time
    Dim Registers As New RegistersDLL(Co nvert.ToUInt16( 1000))
    ....
    status = Registers.RegRe ad("Time", lidarTime)

    I know C++ code is working as it has been fully tetsted. However doing a Build from VB IDE throws a wobbly in that it cannot match the fuction call.

    I have imported the DLL in the VB code.

    Any thoughts?
Working...