Results 1 to 3 of 3

Thread: [RESOLVED] Problem Converting C struct to Vb.Net

  1. #1

    Thread Starter
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Resolved [RESOLVED] Problem Converting C struct to Vb.Net

    Hi, I have a DLL written in C which I want to use in my VB.net Application.
    In order to use it correctly I need to declare the structures from that DLL also in VB.Net.
    Currently I'm stuck with something like this, which I don't really understand.

    Code:
    struc C_Struc
    {
    char WhatEver;
    //Padding
    BYTE          :8;
    WORD         :16;
    };
    I do understand that BYTE and Word types are ued for padding, but what is set for them a value of 8 and 16, 8 and 16 byte???
    Last edited by opus; Oct 12th, 2012 at 02:45 AM.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Problem Converting C struct to Vb.Net

    Duplicate thread has been deleted.

    In C you can specify how many bits (not bytes) each member should occupy.
    Code:
    struct someStruct
    {
      unsigned char high:4;
      unsigned char low:4;
    };
    The above struct will be stored in a single byte.

  3. #3

    Thread Starter
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: [RESOLVED] Problem Converting C struct to Vb.Net

    Sorry for double-posting, maybe it was an age-problem.

    Thanks for the solution.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width