Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid translation of C struct with typedef to D #202

Closed
carun opened this issue Aug 20, 2018 · 0 comments
Closed

Invalid translation of C struct with typedef to D #202

carun opened this issue Aug 20, 2018 · 0 comments
Labels

Comments

@carun
Copy link

carun commented Aug 20, 2018

Using master on Ubuntu 18.04.1 LTS

Input:

typedef struct
{
  char          SerNo[12];          // e.g. "1234512345"  (11 char)
  char          ID[20];             // e.g. "IDS GmbH"
  char          Version[10];        // e.g. "V2.10"  (9 char)
  char          Date[12];           // e.g. "24.01.2006" (11 char)
  unsigned char Select;             // contains board select number for multi board support
  unsigned char Type;               // e.g. IS_BOARD_TYPE_UEYE_USB
  char          Reserved[8];        // (7 char)
} BOARDINFO, *PBOARDINFO;

Actual output:

extern (C):

struct PBOARDINFO
{
    char[12] SerNo; // e.g. "1234512345"  (11 char)
    char[20] ID; // e.g. "IDS GmbH"
    char[10] Version; // e.g. "V2.10"  (9 char)
    char[12] Date; // e.g. "24.01.2006" (11 char)
    ubyte Select; // contains board select number for multi board support
    ubyte Type; // e.g. IS_BOARD_TYPE_UEYE_USB
    char[8] Reserved; // (7 char)
}

Expected output:

extern (C):

struct BOARDINFO
{
    char[12] SerNo; // e.g. "1234512345"  (11 char)
    char[20] ID; // e.g. "IDS GmbH"
    char[10] Version; // e.g. "V2.10"  (9 char)
    char[12] Date; // e.g. "24.01.2006" (11 char)
    ubyte Select; // contains board select number for multi board support
    ubyte Type; // e.g. IS_BOARD_TYPE_UEYE_USB
    char[8] Reserved; // (7 char)
}

alias PBOARDINFO = BOARDINFO*;
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Oct 3, 2018
jacob-carlborg added a commit that referenced this issue Oct 5, 2018
Fix #202: Invalid translation of C struct with typedef to D.
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Dec 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants