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

Errors from separated importc & bitsize pragmas #85

Closed
cdunn2001 opened this issue May 13, 2017 · 0 comments · Fixed by #214
Closed

Errors from separated importc & bitsize pragmas #85

cdunn2001 opened this issue May 13, 2017 · 0 comments · Fixed by #214

Comments

@cdunn2001
Copy link
Contributor

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.

RSDuck added a commit to RSDuck/c2nim that referenced this issue Jun 16, 2021
@RSDuck RSDuck mentioned this issue Jun 16, 2021
@Araq Araq closed this as completed in #214 Jun 16, 2021
Araq pushed a commit that referenced this issue Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant