Skip to content

Errors from separated importc & bitsize pragmas #85

Closed
@cdunn2001

Description

@cdunn2001

I have this:

typedef struct {
    uint32_t read_rest:1, finished:1, dummy:29;
    int tid, beg, end, n_off, i;
    uint64_t curr_off;
    hts_pair64_t *off;
    hts_readrec_func *readrec;
    struct {
        int n, m;
        int *a;
    } bins;
} hts_itr_t;

I end up with stuff like this:

  hts_itr_t* {.importc: "hts_itr_t", header: "hts.h".} = object
    read_rest* {.importc: "read_rest".} {.bitsize: 1.}: uint32_t
    finished* {.importc: "finished".} {.bitsize: 1.}: uint32_t
    ...

The error is something like:

Error: ':' or '=' expected, but found '{.'

I fix this by merging the pragmas, e.g.

    read_rest* {.importc: "read_rest", bitsize: 1.}: uint32

Actually, I have the same problem with the union pragma, which also needs to be merged with the importc pragma but shows a slightly different error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions