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

incorrect typedef order with circular dependency #981

Open
RaphaelDarley opened this issue Jul 2, 2024 · 0 comments
Open

incorrect typedef order with circular dependency #981

RaphaelDarley opened this issue Jul 2, 2024 · 0 comments

Comments

@RaphaelDarley
Copy link

RaphaelDarley commented Jul 2, 2024

I'm using cbindgen and its been working great, but I've run into an issue with two types: value_t and array_t, where a value could be an array and an array is an array of values.

typedef struct array_t
{
  struct value_t *arr;
  uintptr_t len;
} array_t;
typedef struct value_t
{
  value_t_Tag tag;
  union
  {
// ommited
    struct
    {
      struct array_t array;
    };
  };
} value_t;

if array is defined before value it works because it has a pointer, so known size, but cbindgen produces them in the opposite order which produces an error. Is there any way currently to alter this order, if not is would it be possible for me to add support for doing this automatically or manual reordering.

https://github.com/surrealdb/surrealdb.c/tree/02e6eafbc8f1b5d0ff303d4f19ba784ec04b466a
clone the above and run ./test.sh to recreate

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

No branches or pull requests

1 participant