Skip to content

Automatic forward declarations? #4

Description

@rversteegen

Currently, fbfrog ignores forward struct declarations by default, if no definition of the struct appears later:

struct Typ;
extern Typ *x;

translates to

extern x as Typ ptr

whereas if struct Typ {int a;}; appears later you get

type Typ as Typ_
extern x as Typ ptr

type Typ_
	a as long
end type

Without the definition, adding -addforwarddecl Type is necessary to get a working translation.

Why not add a forward declaration automatically if there is a C declaration but no definition; is it not desirable for some reason, or is it simply not implemented? The only reason to avoid doing so that I can think of is if there's another header that fbfrog wasn't given which will have already defined it. But that would be the exception, not the norm, accommodated with a -noforwarddecl option.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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