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

Implicit Forward Declared Struct incorrectly Converted #275

Open
miguelmartin75 opened this issue Dec 17, 2023 · 1 comment
Open

Implicit Forward Declared Struct incorrectly Converted #275

miguelmartin75 opened this issue Dec 17, 2023 · 1 comment

Comments

@miguelmartin75
Copy link

miguelmartin75 commented Dec 17, 2023

For example:

foo.h:

typedef struct FooImpl* Foo;

Should output

discard "forward decl of FooImpl"
type Foo* = ptr FooImpl

However, instead c2nim outputs:

type Foo* = ptr FooImpl

If you attempt to import foo, Nim will complain about FooImpl not being declared.

One can get around this via forward declaring on a separate line in the header file, i.e. the C header should look as follows:

struct FooImpl;
typedef struct FooImpl* Foo;
@miguelmartin75 miguelmartin75 changed the title Implicit Forward Declared Struct in Header Implicit Forward Declared Struct in Header incorrectly Converted Dec 17, 2023
@miguelmartin75 miguelmartin75 changed the title Implicit Forward Declared Struct in Header incorrectly Converted Implicit Forward Declared Struct incorrectly Converted Dec 17, 2023
@miguelmartin75
Copy link
Author

miguelmartin75 commented Dec 17, 2023

Never mind, in both cases, this does not work. I'm not sure how to deal with private/Opaque structs.

Apologies for the noise.

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